Forest Plots for Meta-Analysis with AI: From metafor Output to Submission-Ready Figure
A forest plot is the one figure a meta-analysis reviewer reads closely. It has mandatory elements — an effect estimate and confidence interval for every study, a pooled estimate, a heterogeneity statistic, and the study weights — and an AI-generated version tends to drop at least one of them. The fixable part is knowing which elements go missing and checking for them on every draft.
Start from metafor, not from the model
Run the pooled analysis in R with metafor and hand the model the fitted object: the per-study effect sizes and variances, the random-effects estimate, the tau-squared and I-squared values. At that point the forest plot is a rendering job. Asking a model to both compute the pooled effect and draw the plot invites a summary number you cannot trace back to a documented method — and traceability is exactly what a reviewer probes.
The elements that go missing
The weight column. metafor's own forest() prints it; a hand-built ggplot version often omits it. Reviewers read the weights to see which study is driving the pooled estimate.
Heterogeneity, displayed properly. A p-value alone is not enough. Report I-squared with its interval and tau-squared for a random-effects model. Generated code frequently shows only the test p-value and stops there.
The pooled estimate as a diamond. The diamond's horizontal span is the confidence interval of the pooled effect. A model sometimes renders it as another point with whiskers, which erases a visual convention readers depend on.
Scale and reference line. Ratio measures belong on a log scale with the null line at one; a linear axis distorts the visual weight of effects on either side of it.
The prompt that keeps elements in
Give the model an explicit element list rather than a style request. State that the output must include a weight column, the pooled diamond, the heterogeneity line with I-squared and tau-squared, a log scale for the ratio measure, and the null reference line. Ask it to annotate each study row with the effect estimate and interval as printed text, not only as a plotted point, so the numbers are legible without measuring against the axis. When the list is in the prompt, the model builds to it; when it is not, the model builds to whatever a generic forest plot looked like in its training data, and the missing pieces are the ones journals reject over.
Match it to the reporting checklist
PRISMA 2020 item 20b asks that, for each meta-analysis, you present the summary estimate, its precision, and the measures of statistical heterogeneity. A forest plot is where most journals expect all three to appear together. Run the figure against the checklist before submission — the same structured-audit habit described in using AI in systematic reviews safely.
Read the plot as code
Before the figure enters the manuscript, check the generated code against the fitted object. Do the per-study estimates match metafor's output? Is the pooled diamond the model estimate rather than a re-computation? Does the weight column sum to a sensible total? These are the same output-sanity checks that catch AI-generated statistical code failure modes elsewhere in the analysis pipeline.
Before you submit
A forest plot built from a traceable metafor object, with every mandatory element present, is what survives review. AI for Academic's peer-review stress test at aiforacademic.world checks a meta-analysis manuscript against PRISMA reporting items, including the synthesis and heterogeneity fields a forest plot is meant to carry. Free to start.