[R] p-value from survreg(), library(survival)

Marc Schwartz marc_schwartz at comcast.net
Wed Jul 11 16:34:47 CEST 2007


Actually, in this case, looking at the code for:

  survival:::print.survreg

would be better, as the p value is calculate there, rather than being
part of the survreg object. As with many R functions, the p value is
calculated in the print method for the object.

In this case, it is a pretty straightforward p value for the chi-square
statistic.  Using the output of Vlado's example below:

> format(signif(1 - pchisq(11.39, 1), 2))
[1] "0.00074"

HTH,

Marc Schwartz

On Wed, 2007-07-11 at 16:11 +0200, hadley wickham wrote:
> str(survreg(s~groups, dist="gaussian"))
> 
> is probably a good place to start.
> 
> Hadley
> 
> On 7/11/07, Vlado Sremac <vladosr at gmail.com> wrote:
> > dear r experts:
> > It seems my message got spam filtered, another try:
> > i would appreciate advice on how to get the p-value from the object 'sr'
> > created  with the function survreg() as given below.
> > vlad
> >
> > sr<-survreg(s~groups, dist="gaussian")
> > Coefficients:
> > (Intercept)      groups
> > -0.02138485  0.03868351
> >
> > Scale= 0.01789372
> >
> > Loglik(model)= 31.1   Loglik(intercept only)= 25.4
> >         Chisq= 11.39 on 1 degrees of freedom, p= 0.00074
> > n= 16
> >



More information about the R-help mailing list