Creates a contour-enhanced forest plot for correlation coefficients from multiple studies. Applies Fisher's Z transformation for meta-analysis and displays study-level correlations with 95% confidence intervals, pooled correlation, weights, and heterogeneity statistics.
forest_corr(
dat,
r_col = "r",
n_col = "n",
study_col = "Study",
xlab = "Correlation (r)",
title = "Correlation Forest Plot",
xlim = c(-2.5, 1.5),
diamond.col = "red",
study.col = "blue",
CI.col = "blue",
square.size = 6,
text_size = 3.5,
xpos_study = -1.3,
xpos_n = -1.1,
xpos_ci = 1.2,
xpos_weight = 1.45,
xpos_pooled_label = NULL,
xpos_pooled_value = NULL,
contour_breaks = c(-1, -0.5, -0.3, -0.1, 0, 0.1, 0.3, 0.5, 1),
contour_colors = c("gray70", "gray50", "gray30", "gray10", "gray70", "gray50",
"gray30", "gray10")
)A ggplot object representing the correlation forest plot.
Data frame containing study-level correlation data.
Character. Name of the column containing correlation coefficients. Default is "r".
Character. Name of the column containing sample sizes. Default is "n".
Character. Name of the column containing study labels. Default is "Study".
Character. Label for the x-axis. Default is "Correlation (r)".
Character. Plot title. Default is "Correlation Forest Plot".
Numeric vector of length 2. Limits for the x-axis. Default is c(-2.5,1.5).
Color for the pooled effect diamond. Default is "red".
Color for the study points. Default is "blue".
Color for the horizontal confidence intervals. Default is "blue".
Numeric. Size of the squares representing study effect sizes. Default is 6.
Numeric. Size of text annotations. Default is 3.5.
Numeric. X-position for study labels. Default is -1.3.
Numeric. X-position for sample size labels. Default is -1.1.
Numeric. X-position for correlation (95% CI) labels. Default is 1.2.
Numeric. X-position for study weight labels. Default is 1.45.
Numeric. X-position for the pooled effect label. Default is calculated automatically.
Numeric. X-position for the pooled effect value. Default is calculated automatically.
Numeric vector. Breakpoints for contour shading along the x-axis. Default is c(-1, -0.5, -0.3,-0.1, 0, 0.1, 0.3, 0.5, 1).
Character vector. Colors corresponding to contour breaks. Default is c("gray70","gray50","gray30", "gray10", "gray70", "gray50","gray30","gray10").
if (FALSE) {
dat <- data.frame(
Study = c("Smith 2010","Jones 2012","Lee 2015","Kim 2018"),
r = c(0.2, 0.35, -0.1, 0.5),
n = c(50, 120, 80, 60)
)
forest_corr(dat)
}
Run the code above in your browser using DataLab