我在 R 的 coxph() 中使用了以下函数来拟合 cox 风险模型。我想报告正确的统计数据;但是,输出中没有 95% CI。
Surv(days, censor) ~ gender + age + treatment, data_1)
我只得到以下几列。
coef exp(coef) se(coef) z p
获取与预测变量相关的风险比的置信区间的一个简单方法是在模型拟合中使用“摘要”函数。如果您想要系数估计值本身的置信区间,您可以使用“confit”函数。限制结果的幂也可用于获取风险比置信区间。
fit <- coxph(Surv(t,y) ~ x)
summary(fit) #output provides HR CIs
confint(fit) #coefficient CIs
exp(confint(fit)) #Also HR CIs
library(broom)
library(dplyr)
library(survival)
mod <- coxph(Surv(time, status) ~ sex + age, data = lung)
mod |>
tidy(conf.int = TRUE, exponentiate = TRUE) |>
select(term, estimate, starts_with("conf"))
#> # A tibble: 2 x 4
#> term estimate conf.low conf.high
#> <chr> <dbl> <dbl> <dbl>
#> 1 sex 0.599 0.431 0.831
#> 2 age 1.02 0.999 1.04
中的CI
模型摘要中找到
conf.int
CoxPH
(如果使用R
包)。它位于survival
和lower .95
下2019 年更新(但我认为该建议以前不起作用):
upper .95
输出:
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
coxobj <- coxph(Surv(time, status) ~ x + strata(sex), test1)
coxobj_summary <- summary(coxobj)
coxobj_summary$conf.int
exp(coef) exp(-coef) lower .95 upper .95
x 2.230706 0.4482887 0.4450758 11.18022
和
summary(coxobj)$coefficients
输出并进行一些适合出版的调整以进一步输出处理的人来说可能会派上用场。summary(coxobj)$conf.int