[R] Survreg object

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat May 14 14:08:29 CEST 2011


There is however the generic vcov(), which has a method for class 
"survreg".

One good reason for not having a simple means to extract standard 
errors is that considering coefficients in isolation is often unwise 
(and has come up on R-help more than once already this month).

The summary() method for class "survreg", like many other 
model-fitting functions, has an argument 'correlation'. In the mid 
1990s for S(-PLUS) the default for this argument was usually true.  I 
can see why the R tradition changed to false, but reminding people of 
the correlation matrix when printing the coefficient table had merit.

On Sat, 14 May 2011, David Winsemius wrote:

>
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list