2013-10-30 34 views

回答

1

LR-測試默認情況下,從THR生存包退換由coxph()(見最後一行):

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 
5

有在pkg一個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測試。

+0

在上面的例子中,哪個Model是空模型?謝謝。 – NickBraunagel

+0

我會稱模型1爲「基礎」模型。對於那些在RHS上只有「攔截」的人,我保留術語「空模型」。在這種情況下,模型2('= fit')具有通過在'resid.ds'和'rx'不是基本因子水平的情況下爲1的交互作用形成的額外項。 –