[R] Meaning of pterms in survreg object?

Terry Therneau therneau at mayo.edu
Mon Jan 31 16:10:42 CET 2011


> survmod <- survreg(Surv(sapply(bleedtimes, min, 10), bleedtimes < 10)
>       ~ device + frailty.gaussian(pat))

> residuals(survmod)
> Error in residuals.survreg.penal(survmod) : 
>   Residuals not available for sparse models

 Thanks for the reproducable error.  

 a. With respect to your earliest question, the "pterms" attributes in a
survreg model are used to keep track of penalized terms.  Smoothing
splines and frailties are implimented in this way.

 b. A gaussian frailty with the default "reml" method does not work
correctly with survreg.  See the manual page help('frailty').  

 c. You could use frailty.gaussian(pat, sparse=1000, method='aic').  The
first argument avoids the use of a sparse approximation (your example
had 32 patients which is < 1000), the second uses AIC to choose the size
of the random effect.
   I had forgotton that extension of the residuals to the sparse case
was an addition that I never finished.  With 100 or fewer groups the
full computation is not usually a burden, the sparse matrix
approximations were mostly designed for genetics studies where I have
thousands of subjects.

Terry Therneau



More information about the R-help mailing list