如何使用 add_global_p(car,gtsummary)在逻辑回归 table 中显示 p 值的 3 位有效数字
How do I display 3 significant digits for p values in logistic regression table using add_global_p (car, gtsummary)
Where/how 我是否插入 style_p_value 参数以显示此 table 中 p 值的 3 位有效数字?
if (requireNamespace("car")) {
tbl_uv_global_ex2 <-
trial[c("response", "trt", "age", "grade")] %>%
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial),
exponentiate = TRUE
) %>%
add_global_p()
}
下面的例子有 3 个 sigfigs 作为 p 值:)
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.4.2'
tbl <-
trial[c("response", "trt", "age", "grade")] %>%
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial),
exponentiate = TRUE,
pvalue_fun = ~style_sigfig(., digits = 3) # style p-values with 3 sig figs
) %>%
add_global_p()
#> add_global_p: Global p-values for variable(s) `add_global_p(include = c("trt",
#> "age", "grade"))` were calculated with
#> `car::Anova(mod = x$model_obj, type = "III")`
由 reprex package (v2.0.1)
于 2021-09-14 创建
Where/how 我是否插入 style_p_value 参数以显示此 table 中 p 值的 3 位有效数字?
if (requireNamespace("car")) {
tbl_uv_global_ex2 <-
trial[c("response", "trt", "age", "grade")] %>%
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial),
exponentiate = TRUE
) %>%
add_global_p()
}
下面的例子有 3 个 sigfigs 作为 p 值:)
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.4.2'
tbl <-
trial[c("response", "trt", "age", "grade")] %>%
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial),
exponentiate = TRUE,
pvalue_fun = ~style_sigfig(., digits = 3) # style p-values with 3 sig figs
) %>%
add_global_p()
#> add_global_p: Global p-values for variable(s) `add_global_p(include = c("trt",
#> "age", "grade"))` were calculated with
#> `car::Anova(mod = x$model_obj, type = "III")`