我正在使用 gtsummary 包从逻辑回归生成表。
例如,我想使用试验数据中的阶段级别“T3”作为参考级别,而不是默认的“T1”。我怎样才能在这个示例代码中做到这一点?
我的目标是对单变量和多变量逻辑回归都这样做,所以我假设答案适用于这两种情况。
library(gtsummary)
library(dplyr)
trial %>%
dplyr::select(age, trt, marker, stage, response, death, ttdeath) %>%
tbl_uvregression(
method = glm,
y = death,
method.args = list(family = binomial),
exponentiate = TRUE,
pvalue_fun = function(x) style_pvalue(x, digits = 2)) %>%
# overrides the default that shows p-values for each level
add_global_p() %>%
# adjusts global p-values for multiple testing (default method: FDR)
add_q() %>%
# bold p-values under a given threshold (default 0.05)
bold_p() %>%
# now bold q-values under the threshold of 0.10
bold_p(t = 0.10, q = TRUE) %>%
bold_labels() %>% as_gt()
真诚的,耐莉