Likelihood Ratio Test for Cox Models in R

Vicki Hamill picture Vicki Hamill · Oct 30, 2013 · Viewed 10.7k times · Source

Does anyone know of a likelihood ratio test, like lrtest in the lmtest package, that works for cox proportional hazards models produced using coxph? lrtest does not seem to work for coxph models.

Thanks

Answer

IRTFM picture IRTFM · Oct 30, 2013

There is an anova.coxph in pkg:survival which allows comparison of model objects.

fit <- coxph(Surv(futime, fustat) ~ resid.ds *rx + ecog.ps, data = ovarian) 
fit2 <- coxph(Surv(futime, fustat) ~ resid.ds +rx + ecog.ps, data=ovarian)
anova(fit2,fit)

Analysis of Deviance Table
 Cox model: response is  Surv(futime, fustat)
 Model 1: ~ resid.ds + rx + ecog.ps
 Model 2: ~ resid.ds * rx + ecog.ps
   loglik  Chisq Df P(>|Chi|) 
1 -31.970                    
2 -30.946 2.0469  1    0.1525

This is an LR test.