我使用下面的代码创建了一个基于多变量 Cox PH 回归的森林图(来自
forestmodel
包)。然而,该图包括效果估计、95% 置信区间和 p 值,从而使森林图本身显得更小。如何抑制/省略图中的估计值以及 95% CI 和 p 值?预先感谢!
cox_model <- coxph(Surv(`_t`, died) ~ x1 + x2 + x3 + x4 + x5, id = record_id, data = data)
forest_model(
cox_model,
panels = default_forest_panels(cox_model, factor_separate_line = ),
covariates = NULL,
exponentiate = TRUE,
funcs = NULL,
factor_separate_line = FALSE,
format_options = forest_model_format_options(),
theme = theme_forest(),
limits = NULL,
breaks = NULL,
return_data = FALSE,
recalculate_width = TRUE,
recalculate_height = TRUE,
model_list = NULL,
merge_models = FALSE,
exclude_infinite_cis = TRUE,
)
我尝试使用
forest_panel
函数来指定要显示绘图的哪些列,但显然,这不起作用,或者我可能错过了一些东西。
您需要一个自定义面板。
panels <- list(
list(width = 0.03),
list(width = 0.1, display = ~variable, fontface = "bold", heading = "Variable"),
list(width = 0.1, display = ~level),
list(width = 0.05, display = ~n, hjust = 1, heading = "N"),
list(width = 0.05, display = ~n_events, width = 0.05, hjust = 1, heading = "Events"),
list(width = 0.03),
list(
width = 0.55, item = "forest", hjust = 0.5, heading = "Hazard ratio", linetype = "dashed",
line_x = 0
)
library("survival")
library("dplyr")
pretty_lung <- lung %>%
transmute(time,
status,
Age = age,
Sex = factor(sex, labels = c("Male", "Female")),
ECOG = factor(lung$ph.ecog),
`Meal Cal` = meal.cal
)
forest_model(coxph(Surv(time, status) ~ ., pretty_lung), panels) +
scale_y_discrete(expand=c(0.1,0)) +
ggtitle("Custom panel")