![](/img/trans.png)
[英]Export Cox regression results to excel or word using publish package
[英]Exponentiate regression results in huxtable
我將一些表格與一系列 Cox 比例風險模型的結果放在一起。 我想對系數取冪,以便表格顯示風險比而不是原始 beta 值。 有誰知道用 huxtable 做到這一點的方法嗎? 這是我建立回歸表的首選 package。 我做了一些谷歌搜索,找不到解決方案。
您可以將tidy_args
參數用於 huxreg:
library(huxtable)
library(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))
mod <- coxph(Surv(time, status) ~ x + strata(sex), test1)
huxreg(mod)
─────────────────────────────────────────────────
(1)
─────────────────────────
x 0.802
(0.822)
─────────────────────────
N 5.000
R2 0.144
logLik -3.328
AIC 8.655
─────────────────────────────────────────────────
*** p < 0.001; ** p < 0.01; * p < 0.05.
Column names: names, model1
huxreg(mod, tidy_args = list(exponentiate = TRUE))
─────────────────────────────────────────────────
(1)
─────────────────────────
x 2.231
(0.822)
─────────────────────────
N 5.000
R2 0.144
logLik -3.328
AIC 8.655
─────────────────────────────────────────────────
*** p < 0.001; ** p < 0.01; * p < 0.05.
Column names: names, model1
tidy(mod, exponentiate = TRUE)
似乎對系數取冪而不是標准誤差,這可能是broom
中的一個錯誤並且值得報告? 不過,置信區間看起來是正確的,因此您可以:
huxreg(mod, tidy_args = list(exponentiate = TRUE),
error_format = "[{conf.low}-{conf.high}]", ci_level = 0.95)
─────────────────────────────────────────────────
(1)
─────────────────────────
x 2.231
[0.445-11.180]
─────────────────────────
N 5.000
R2 0.144
logLik -3.328
AIC 8.655
─────────────────────────────────────────────────
*** p < 0.001; ** p < 0.01; * p < 0.05.
Column names: names, model1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.