Skip to contents

Create a forest plot showing both ML-UMR adjusted and unadjusted (naive) treatment effect estimates side-by-side for direct comparison. This helps visualize the impact of population adjustment on treatment effects.

Usage

plot_forest_comparison(
  object,
  effect_type = c("lor", "rd", "rr"),
  show_unadjusted = TRUE,
  populations = c("both", "index", "comparator"),
  null_value = NULL,
  colors = NULL,
  labels = NULL
)

Arguments

object

An mlumr_fit object

effect_type

Effect measure to plot: "lor" (log odds ratio), "rd" (risk difference), or "rr" (risk ratio). Default is "lor".

show_unadjusted

Logical. Include unadjusted estimates? Default TRUE.

populations

Which populations to show: "both", "index", or "comparator". Default is "both".

null_value

Reference line value. Default is 0 for LOR/RD, 1 for RR.

colors

Named vector of colors for adjusted/unadjusted. Default is c(Adjusted = "#2166AC", Unadjusted = "#B2182B").

labels

Named vector of custom labels for estimate types. Default is c(Adjusted = "ML-UMR Adjusted", Unadjusted = "Unadjusted (Naive)").

Value

A ggplot object

Examples

if (FALSE) { # \dontrun{
# Basic forest comparison plot
plot_forest_comparison(fit)

# Show only index population
plot_forest_comparison(fit, populations = "index")

# Risk difference instead of log odds ratio
plot_forest_comparison(fit, effect_type = "rd")

# Custom colors
plot_forest_comparison(fit, colors = c(Adjusted = "blue", Unadjusted = "red"))
} # }