Reputation: 438
I would like to compare the model fits of Cox proportional-hazards models with a likelihood-ratio test (or equivalent). This usually works by comparing the fit with the anova()
function. However, when I have data that is organized in clusters and therefore has to be defined that way, this does not work. See the example below (the lung data set is included in the survival package):
library(survival)
data(lung)
lung_cox <- coxph(Surv(time, event = status) ~ age + cluster(sex), data = lung)
lung_cox1 <- coxph(Surv(time, event = status) ~ 1 + cluster(sex), data = lung)
anova(lung_cox, lung_cox1)
The error I get after the anova()
function is:
Error in anova.coxphlist(c(list(object), dotargs), test = test) : Can't do anova tables with robust variances
Is there a way to work around this? I'm quite new to survival analysis in R, so maybe I'm not aware of a certain package that provides this?
Many thanks!
Upvotes: 3
Views: 314