[R] survival package test stats

Terry Therneau therneau at mayo.edu
Thu Jul 3 13:53:48 CEST 2008


>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



More information about the R-help mailing list