[R] predicting from coxph with pspline
Terry Therneau
therneau at mayo.edu
Mon May 12 20:13:15 CEST 2008
-== begin included message ---------
Hello.
I get a bit confused by the output from the predict function when used
on an object from coxph in combination with p-spline, e.g.
fit <- coxph(Surv(time1, time2, status)~pspline(x), Data)
predict(fit, newdata=data.frame(x=1:2))
--------- end included ----------
Yes, you should be confused. Coxph still retains a well known problem with S
models, namely that the prediction is incorrect when there are data-dependent
transformations in the formula such as ns(), poly() or pspline(). That is, the
set of basis functions chosen by pspline(x) depends on the range of x; for a new
data prediction the basis functions are re-calculated, giving results that are
wrong (unless the new x happens to have the exact same lower and upper limits).
This is on my to-be-fixed list. Once a few other things are cleared away
(actually a long list of other things). These fixes have been applied to lm
and others for long enough now, coxph needs to catch up.
Terry Therneau
More information about the R-help
mailing list