Forest Plot Comparing Adjusted vs Unadjusted Estimates
Source:R/plot_extensions.R
plot_forest_comparison.RdCreate 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.
Arguments
- object
An
mlumr_fitobject- 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)").
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"))
} # }