[R] Using method = "aic" with pspline & survreg

Terry Therneau therneau at mayo.edu
Fri Sep 23 15:43:37 CEST 2011

--- begin inclusion --
Hi everybody.  I'm trying to fit a weibull survival model with a spline
basis for the predictor, using the survival library.  I've noticed that
doesn't seem to be possible to use the aic method to choose the degrees
freedom for the spline basis in a parametric regression (although it's
fine with the cox model, or if the degrees of freedom are specified
by the user), and I was wondering if there is some reason for this?
 --- end inclusion ---

  A simple reason as it turns out: there was an incorrect variable name
in the survpenal.fit function.  A "variable not found" error is exactly
what one would expect.  I've now repaired the function for version
2.36.10 (which I hope to post shortly).  
 The big surprise is that it has been wrong for about a decade, and no
one had ever tried a situation that exercised that particular line of
code -- or at least they never told me about the error.

  Thank you for the very clear description of the problem, which made it
easy for me to track it down.

Terry Therneau

More information about the R-help mailing list