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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With