I am trying to fit a cox proportional hazards model with several categorical and one continuous covariate. The plot of martingale's residuals from the null model against the continuous term suggests that the functional form of the continuous covariate is nonlinear. Therefore, I have decided to fit a penalised smoothing spline to the continuous covariate as outlined in this vignette.

I have used the pspline() function from the survival package. I have set the df argument to 0 and the function uses the AIC to choose the optimal degrees of freedom.

cox model with spline fit

I am struggling to understand why the continuous variable, DEC, in the model is fitted with a linear and a non-linear component, both of which are significant. I can plot the non-linear component of the fit for my continuous variable using the code outlined here.

enter image description here

Interpreting the non-linear component of the fit for the continuous variable, it seems that the hazard ratio increases until the 9th decade before reducing.

I thought the reason for splines was to model non-linear relationships. Should I ignore the linear component of the spline and just interpret the nonlinear component?

  • 2
    $\begingroup$ All splines (indeed, literally any real function $f$ of a real number) can be viewed as "having a linear component." This comes down to re-expressing the function as $f(x) = (f(x) - \alpha - \beta x) + \alpha + \beta x.$ This is useful when the "nonlinear term" $f(x) - \alpha-\beta x$ tends to be small. In particular, the "linear component" $\alpha+\beta x$ usually cannot be ignored! $\endgroup$ – whuber Mar 19 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.