Modeling the Mean with Time as a Categorical Variable in Longitudinal Designs for Smaller-Sized Clinical Trials: A Case Studies Approach Based on Three Phase 3 Clinical Trials in Rare Diseases
Estimating nonlinear exposure effects in Cox regression models is essential for accurately characterizing exposure–disease relationships, yet the presence of measurement error in exposures poses major challenges. While regression calibration has been widely applied under rare disease assumptions with linear exposure effects, recent work has extended the approach to accommodate quadratic and quantile effects. We generalize this framework to handle arbitrary polynomial and spline-based representations of the exposure effect, thereby enabling flexible modelling of complex nonlinear associations. Our method combines regression calibration with Monte Carlo integration to evaluate the conditional expectation of the hazard function when analytical solutions are unavailable. Furthermore, by stacking the estimating functions from both the Cox regression and measurement error models, we construct a sandwich variance estimator that avoids computationally intensive bootstrap procedures. To facilitate practical use, we implement our approach in the R package NonLinearRC.