是否有人知道似然比测试,如lmtest包中的lrtest,适用于使用coxph生成的cox比例风险模型? lrtest似乎不适用于coxph模型。
由于
答案 0 :(得分:7)
pkg:survival中有anova.coxph
,可以比较模型对象。
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
这是LR测试。
答案 1 :(得分:2)
LR-Test默认由coxph()
从thr survival package返回(参见最后一行):
require(survival)
test1 <- list(time=c(4,3,1,1,2,2,3),
status=c(1,1,1,0,1,1,0),
x=c(0,2,1,1,1,0,0),
sex=c(0,0,0,0,1,1,1))
# Fit a stratified model
coxph(Surv(time, status) ~ x + strata(sex), test1)
Call:
coxph(formula = Surv(time, status) ~ x + strata(sex), data = test1)
coef exp(coef) se(coef) z p
x 0.802 2.23 0.822 0.976 0.33
Likelihood ratio test=1.09 on 1 df, p=0.297 n= 7, number of events= 5