[R] how to check linearity in Cox regression
mmargoli at gettysburg.edu
Tue Nov 25 16:00:56 CET 2008
On examining non-linearity of Cox coefficients with penalized splines - I
have not been able to dig up a completely clear description of the test
performed in R or S-plus.
>From the Therneau and Grambsch book (2000 - page 126) I gather that the test
reported for "linear" has as its null hypothesis that the spline coefficient
is the same at the center of basis. Thus, in the example quoted below (from
the thread) one might say treating age as linear is not too bad, to the
extent that failure to reject a null can be so interpreted.
Is that right? And what is the null for the nonlinear test?
Use pspline within a Cox model. It includes a fairly general test for
nonlinearity, that is similar to GAM models.
> coxph(Surv(time, status) ~ ph.ecog + pspline(age), lung)
coxph(formula = Surv(time, status) ~ ph.ecog + pspline(age),
data = lung)
coef se(coef) se2 Chisq DF p
ph.ecog 0.4505 0.11766 0.11723 14.66 1.00 0.00013
pspline(age), linear 0.0112 0.00927 0.00927 1.45 1.00 0.23000
pspline(age), nonlin 2.96 3.08 0.41000
Iterations: 4 outer, 10 Newton-Raphson
Degrees of freedom for terms= 1.0 4.1
Likelihood ratio test=22.7 on 5.07 df, p=0.000412
n=227 (1 observation deleted due to missingness)
More information about the R-help