0

I am utilizing a cox model for time to event analysis. I have a continuous predictor, that appeared to violate the linearity assumption. I then re-did my model with a spline function, and compared my two models with a likelihood ratio test like so:

model_a ~ A + B + C

model_b ~ A + B + pspline(C)

anova(model_a, model_b, test = "LRT")

The likelihood ratio test said the models did not significantly differ. Even if variable C violates the linearity assumption, will I still need to use the spline function? I am concerned about the increasing complexity of result interpretation having the spline would add, especially if it appears the models do not differ.

  • By "violates the linearity assumption," do you mean violates the proportional hazards assumption? – Todd D Jun 01 '22 at 23:12
  • Maybe "functional form" would have been a better wording; a plot of the continuous covariate against the martingale residuals of the null model was non-linear, and from what I've read it should be linear to meet the assumptions of the cox model – az_1890 Jun 01 '22 at 23:24

1 Answers1

0

It is best to choose the functional form of a variable based on your knowledge of the relationship of that variable to the outcome of interest and to do this prior to analysis. Looking at the martingale plot is also reasonable. For a paper on this subject, see here.

If you truly have no preconception of whether C is linear or nonlinear with respect to the outcome, it is reasonable to do a test. However, you may want to use the Akaike Information Criterion to help gauge what is the better functional form. While closely related to the LR test you used, the AIC contains a penalty for the number of variables in the model (eg, splines).

Also see: AIC model comparison, null model, p-value and Equivalence of AIC and p-values in model selection

Todd D
  • 2,221
  • 1
  • 13
  • 18