Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Likelihood Ratio Test for Cox Models in R

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

like image 439
Dr Vicki Avatar asked Dec 20 '22 22:12

Dr Vicki


1 Answers

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.

w.r.t. the comment. A "null model" in Cox regression would be formed with only a 1 on the RHS of the formula-tilde:

fit <- coxph(Surv(futime, fustat) ~ 1, data = ovarian)
like image 155
IRTFM Avatar answered Jan 12 '23 23:01

IRTFM