[R] Survreg object

David Winsemius dwinsemius at comcast.net
Sat May 14 13:28:04 CEST 2011


On May 14, 2011, at 5:48 AM, andre bedon wrote:

>
> Hi,Just a quick one, does anyone know the command for accessing the  
> standard errors from a survreg object? I can access the coefficients  
> by model$coefficients, but I cant seem to find a command to access  
> the errors. Any help would be greatly appreciated.Regards,Andre 		 	

I do not see an se.coef extractor function in the help pages for  
survreg or survreg.object, so I guess you need to make one:

fit <- survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian,  
dist='weibull',
                                     scale=1)
Two methods seem to be equivalent on the first example in help(survreg):

summary(fit)$table[ , "Std. Error"]
(Intercept)     ecog.ps          rx
   1.3218774   0.5869936   0.5869936

sqrt(diag(fit$var))
(Intercept)     ecog.ps          rx
   1.3218774   0.5869936   0.5869936

The first one is preferred because after looking at the  
summary.survreg function, one sees that it first checks for other  
conditions that were recorded in the fit object and only if those are  
met does it apply the second method, and it further checks to see if  
robust errors had been requested.

There can be some risk in creating your own extraction methods, since  
the author of a package may have had reasons for not making it  
available, but in this case he did offer a table that includes the  
component you were requesting.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list