Generates a contour-enhanced forest plot for binary outcome data (e.g., odds ratios, risk ratios), with study-level effects, confidence intervals, pooled effect, prediction interval, and heterogeneity statistics.
forest_bin(
dat,
measure = "OR",
method = "REML",
xlab = "",
title = NULL,
model = "Random-effects",
estimator = "REML",
nc_col = "n_c",
ne_col = "n_t",
event_c_col = "events_c",
event_t_col = "events_t",
diamond.col = "red",
study.col = "blue",
CI.col = "blue",
Pred.Inter.col = "black",
square.size = 10,
contour_fill = c("gray95", "gray80", "gray60", "gray40"),
text_size = 3.5,
xlim = c(-1.7, 3.5),
pred = TRUE,
xpos = list(EventsT = -0.9, EventsC = -0.3, Effect = 2.6, Weight = 3.1),
study_x = -1.8,
hetero_x = -1.7,
tlim = c(0, 2.3),
truncate_PI = FALSE,
contour_left_min = c(0, 0.5, 0.67, 0.83),
contour_left_max = c(0.5, 0.67, 0.83, 1),
contour_right_min = c(1, 1.2, 1.5, 2),
contour_right_max = c(1.2, 1.5, 2, 2.5)
)A ggplot2 object of the forest plot.
Data frame containing study-level binary outcome data.
Character. Effect measure ("OR" for odds ratio, "RR" for risk ratio, etc.).
Character. Method for meta-analysis heterogeneity estimation (default "REML").
Character. Label for the x-axis.
Character. Plot title. If NULL, a default title is generated.
Character. Meta-analysis model ("Random-effects" or "Fixed-effects").
Character. Estimator used in the meta-analysis (default "REML").
Character. Column name for control group sample sizes.
Character. Column name for treatment group sample sizes.
Character. Column name for number of events in control group.
Character. Column name for number of events in treatment group.
Color of the pooled effect polygon.
Color of the study-level effect points.
Color of the study-level confidence interval lines.
Color of the prediction interval line.
Numeric. Maximum size of study-level effect squares.
Vector of colors for contour shading levels.
Numeric. Base size of plot text.
Numeric vector of length 2. Limits of the x-axis.
Logical. Whether to show the prediction interval.
List of numeric positions for text labels (EventsT, EventsC, Effect, Weight).
Numeric. X-position for study names.
Numeric. X-position for heterogeneity text.
Numeric vector of length 2. Limits for truncating study confidence intervals.
Logical. Whether to truncate the prediction interval to tlim.
Numeric vector. Minimum x-values for left-side contour shading.
Numeric vector. Maximum x-values for left-side contour shading.
Numeric vector. Minimum x-values for right-side contour shading.
Numeric vector. Maximum x-values for right-side contour shading.
forest_bin(
dat = bcg(),
measure = "OR",
xlab = "Odds Ratio",
title = "BCG Vaccine Meta-analysis",
tlim = c(0, 2.3),
contour_left_min = c(0,0.3,0.5,0.7),
contour_left_max = c(0.3,0.5,0.7,1),
contour_right_min = c(1,1.2,1.5,1.8),
contour_right_max = c(1.2,1.5,1.8,2.5)
)
Run the code above in your browser using DataLab