I used the code below to create a forest plot (from the forestmodel package) based on a multivariable Cox PH regression. However, the plot includes the effect estimates, 95% confidence intervals, and p-values, thereby making the forest plot itself appear smaller. How can I suppress/omit the estimates and 95% CI and p-values in the plot? Thanks in advance!

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,
)

I have tried using the forest_panel function to specify which columns of the plot to display but apparently, this did not work or I might have missed something.

1

There are 1 answers

0
Dila On

You would need a custom panel.

example custom 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
  )

Example forest plot

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")

forest plot with a custom panel