ejg*_*ejg 3 r confidence-interval
我在R的coxph()中使用了以下函数来拟合cox危险模型.我想报告正确的统计数据; 但是,输出中没有95%的CI.
Surv(days, censor) ~ gender + age + treatment, data_1)
我只得到以下列.
coef exp(coef) se(coef) z p
小智 7
获得与预测变量相关的风险比的置信区间的一种简单方法是在模型拟合上使用"汇总"函数.如果您想要系数估计值的置信区间,您可以使用"confint"函数.来自confint的结果的指数也可用于获得风险比置信区间.
fit <- coxph(Surv(t,y) ~ x)
summary(fit) #output provides HR CIs
confint(fit) #coefficient CIs
exp(confint(fit)) #Also HR CIs
Run Code Online (Sandbox Code Playgroud)
如果您需要此信息进行进一步处理,请考虑tidy以下解决方案broom:
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
Run Code Online (Sandbox Code Playgroud)
更多详细信息请参见此参考
| 归档时间: |
|
| 查看次数: |
6649 次 |
| 最近记录: |