在 RI 中,可以使用生存包中的 coxph 来拟合生存时间(time
和event
)和自变量的 Cox 比例风险模型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 比例风险模型与控制变量拟合还有哪些其他想法?