在RI中可以使用来自生存包的coxph来拟合Cox比例风险模型的生存时间(time
和event
)和自变量stat
,但我不确定如何控制pol
的可能影响,而不仅仅是将其作为另一个自变量包含在模型中。以下是两个模型,一个有一个,一个没有控制变量。
> colnames(first.data)
[1] "state" "year" "event" "time" "contag_per" "one_neigh_dis"
[7] "pol" "demveto" "dem_cont" "tr.ma" "stat"
> coxph = coxph(Surv(time, event) ~ stat, data = first.data, method = "breslow")
> summary(coxph)
Call:
coxph(formula = Surv(time, event) ~ stat, data = first.data,
method = "breslow")
n= 48, number of events= 45
(2 observations deleted due to missingness)
coef exp(coef) se(coef) z Pr(>|z|)
stat -4.429e+01 5.835e-20 1.318e+01 -3.361 0.000777 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
exp(coef) exp(-coef) lower .95 upper .95
stat 5.835e-20 1.714e+19 3.542e-31 9.612e-09
Concordance= 0.708 (se = 0.059 )
Rsquare= 0.239 (max possible= 0.997 )
Likelihood ratio test= 13.12 on 1 df, p=0.0002923
Wald test = 11.3 on 1 df, p=0.000777
Score (logrank) test = 11.77 on 1 df, p=0.0006022
具有独立(stat
)和控制变量(pol
)
> coxph = coxph(Surv(time, event) ~ stat + pol, data = first.data, method = "breslow")
> summary(coxph)
Call:
coxph(formula = Surv(time, event) ~ stat + pol,
data = first.data, method = "breslow")
n= 47, number of events= 44
(3 observations deleted due to missingness)
coef exp(coef) se(coef) z Pr(>|z|)
stat -4.121e+01 1.264e-18 1.341e+01 -3.072 0.00212 **
pol 3.778e+00 4.372e+01 1.745e+00 2.165 0.03042 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
exp(coef) exp(-coef) lower .95 upper .95
stat 1.264e-18 7.911e+17 4.830e-30 3.308e-07
pol 4.372e+01 2.287e-02 1.429e+00 1.337e+03
Concordance= 0.746 (se = 0.059 )
Rsquare= 0.318 (max possible= 0.997 )
Likelihood ratio test= 17.99 on 2 df, p=0.0001242
Wald test = 14.29 on 2 df, p=0.0007899
Score (logrank) test = 15.27 on 2 df, p=0.0004833
使用R生存包对控制变量拟合cox比例风险模型还有什么其他想法?