Re: [R] Survreg object

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Sat, 14 May 2011 07:28:04 -0400

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. Received on Sat 14 May 2011 - 11:31:21 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 14 May 2011 - 12:20:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive