Re: [R] survival package test stats

From: Terry Therneau <therneau_at_mayo.edu>
Date: Thu, 03 Jul 2008 06:53:48 -0500 (CDT)


>Is there a function in the survival package that will allow me to test a subset
>of independent variables for joint significance? I am thinking along the lines
>of a Wald, likelihood ratio, or F-test. I am using the survreg procedure to
>estimate my parameters. Thank you.

 The most direct is to use a likelihood ratio test. However, be careful about deletions due to missing!

> fit1 <- survreg(Surv(time, status) ~ age + ph.ecog, lung)
> fit2 <- update(fit1, .~ .+ meal.cal + wt.loss)
> 2*(fit2$log - fit1$log)[2] # wrong -- different sample sizes

> tdata <- na.omit(lung[, c('time', 'status', 'ph.ecog', 'age', 'wt.loss',

            'meal.cal')
> fit1 <- survreg(Surv(time, status) ~ age + ph.ecog, tdata)
> fit2 <- update(fit1, .~ .+ meal.cal + wt.loss)
> 2*(fit2$log - fit1$log) #this will be chisq on 2 df
 [2] [1] 1.014557

>anova(fit1, fit2)

   nicer format, but wide for this email so omitted        

           Terry Therneau



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 Thu 03 Jul 2008 - 12:04:05 GMT

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 Thu 03 Jul 2008 - 12:31:52 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