# Meta-analysis forest plot maker

> Paste study rows (event counts, means and SDs, or effects with 95% CIs): pooled effect, I², τ², forest and funnel plots. Free, in your browser.

URL: https://www.labcanvas.com/tools/forest-plot-maker

Paste one row per study (events and totals in each group, means, SDs and Ns, or an effect with its 95% confidence interval or standard error) and the tool pools them by inverse-variance meta-analysis: the random-effects estimate (REML, DerSimonian–Laird or Paule–Mandel τ²) and the fixed-effect one (Mantel–Haenszel for counts), with heterogeneity (I², τ², Cochran’s Q), the 95% prediction interval and Egger’s test, drawn as a forest plot and a funnel plot. Ratios (risk ratios, odds ratios, hazard ratios) are pooled on the log scale.

## Quick answer

- **What it does:** Pools study effects by fixed- and random-effects meta-analysis and draws the forest plot (each study’s effect and 95% CI, squares sized by weight, the pooled diamond) and the funnel plot.
- **Formula:** Pooled θ = Σwᵢyᵢ / Σwᵢ with wᵢ = 1/(vᵢ + τ²); SE = 1/√Σwᵢ; Q = Σ(yᵢ − θ_FE)²/vᵢ; I² = (Q − df)/Q.
- **Example:** 13 BCG vaccine trials (Colditz et al. 1994): random-effects (REML) risk ratio 0.489 (95% CI 0.344 to 0.696), τ² = 0.313, I² = 92.2%, Q(12) = 152.2; 95% prediction interval 0.134 to 1.79.

Free, in the browser, no account needed. Updated 2026-11-17.

## Features

- Four input layouts: events and totals (2 × 2 tables), means/SDs/Ns, effect with 95% CI, effect with SE
- Risk ratio, odds ratio or risk difference for counts; Hedges’ g or mean difference for means; ratios such as hazard ratios pooled on the log scale
- Random effects with REML (default), DerSimonian–Laird or Paule–Mandel τ², optional Hartung–Knapp interval; fixed effect (Mantel–Haenszel for counts)
- Heterogeneity: τ² with its Q-profile CI, I² with its CI, H², Cochran’s Q and its P value
- 95% prediction interval for the effect in a new study
- Forest plot with squares sized by weight, the pooled diamond and the prediction interval; funnel plot with Egger’s test
- Study table with each effect, 95% CI and fixed and random weights (copies into Excel)
- Opens in the LabCanvas Graph app with the same analysis; PNG at 300 or 600 dpi, CSV; nothing is uploaded

## How to use it

1. **Choose what your studies report**: Events and totals, means/SDs/Ns, an effect with its 95% CI, or an effect with its SE, and the effect measure.
2. **Paste one row per study**: Study name first, then the numbers in the order of the columns. Paste straight from Excel; rows with a missing value are left out and listed.
3. **Read the pooled effect**: The headline is the pooled effect with its 95% CI; check I² and the prediction interval for how much the studies disagree, then copy the table, the methods sentence or the plots.

## At a glance

| | |
| --- | --- |
| Input | One row per study: events and totals, means/SDs/Ns, effect with 95% CI, or effect with SE |
| Measures | Risk ratio, odds ratio, risk difference, Hedges’ g, mean difference, any ratio or difference |
| Models | Random effects (REML, DerSimonian–Laird, Paule–Mandel; Hartung–Knapp option), fixed effect (inverse variance, Mantel–Haenszel) |
| Output | Pooled effect with 95% CI and P, I², τ², Q, prediction interval, Egger’s test, forest and funnel plots |
| Accuracy | Reproduces metafor’s published BCG results; matches statsmodels to 10⁻⁹ |

## How it works

**Effect sizes.** Each study gives an effect \(y_i\) and its variance \(v_i\). Counts give the log risk ratio \(\ln[(a/n_1)/(c/n_2)]\) with \(v = 1/a - 1/n_1 + 1/c - 1/n_2\), the log odds ratio with \(v = 1/a + 1/b + 1/c + 1/d\), or the risk difference; ½ is added to every cell of a study with a zero cell, and studies with no events in either group are left out of ratio measures. Means give Hedges’ g, the standardised mean difference with the small-sample correction \(J\) (as metafor’s `escalc("SMD")`), with \(v = 1/n_1 + 1/n_2 + g^2/(2(n_1 + n_2))\), or the raw mean difference. An effect with a 95% CI gives \(v = ((\text{upper} - \text{lower}) / (2 \times 1.96))^2\), on the log scale for ratios.

**Pooling.** The fixed-effect estimate weights each study by \(1/v_i\) (for counts, the Mantel–Haenszel estimate is shown). The random-effects model adds the between-study variance \(\tau^2\):

$$\hat\theta = \frac{\sum w_i y_i}{\sum w_i}, \qquad w_i = \frac{1}{v_i + \hat\tau^2}, \qquad \mathrm{SE}(\hat\theta) = \frac{1}{\sqrt{\sum w_i}}$$

\(\tau^2\) is estimated by restricted maximum likelihood (REML, the default in metafor), by DerSimonian and Laird’s method of moments (1986) or by Paule–Mandel. The Hartung–Knapp option replaces the normal CI by a t interval with \(k - 1\) degrees of freedom, which keeps its coverage with few studies (IntHout et al. 2014).

**Heterogeneity.** Cochran’s \(Q = \sum (y_i - \hat\theta_{FE})^2 / v_i\) is tested against \(\chi^2_{k-1}\); \(I^2 = (Q - (k - 1))/Q\) (floored at 0) is the share of the variation in effects due to real differences between studies rather than chance (Higgins et al. 2003). The 95% prediction interval, \(\hat\theta \pm t_{k-2}\sqrt{\hat\tau^2 + \mathrm{SE}^2}\), is where the true effect of a new study would be expected (Riley et al. 2011).

**Small-study effects.** Egger’s test regresses \(y_i/\mathrm{SE}_i\) on \(1/\mathrm{SE}_i\); an intercept far from 0 means an asymmetric funnel plot (Egger et al. 1997). It has little power with fewer than 10 studies.

**Accuracy.** The analysis and the plots are the LabCanvas Graph app’s own meta-analysis, run in your browser. On the BCG trials it reproduces metafor’s published REML results (log risk ratio −0.7145, SE 0.1798, τ² 0.3132, I² 92.22%, Q 152.23) and its DerSimonian–Laird ones, and on a meta-analysis of means it matches statsmodels’ `combine_effects` to 10⁻⁹ (scripts/forest-plot-maker-check.ts).

Sources: DerSimonian R, Laird N. Meta-analysis in clinical trials. *Control Clin Trials* 1986;7:177–188, [doi:10.1016/0197-2456(86)90046-2](https://doi.org/10.1016/0197-2456(86)90046-2). Higgins JPT, Thompson SG, Deeks JJ, Altman DG. Measuring inconsistency in meta-analyses. *BMJ* 2003;327:557–560, [doi:10.1136/bmj.327.7414.557](https://doi.org/10.1136/bmj.327.7414.557). Riley RD, Higgins JPT, Deeks JJ. Interpretation of random effects meta-analyses. *BMJ* 2011;342:d549, [doi:10.1136/bmj.d549](https://doi.org/10.1136/bmj.d549). Egger M, Davey Smith G, Schneider M, Minder C. Bias in meta-analysis detected by a simple, graphical test. *BMJ* 1997;315:629–634, [doi:10.1136/bmj.315.7109.629](https://doi.org/10.1136/bmj.315.7109.629). IntHout J, Ioannidis JPA, Borm GF. The Hartung-Knapp-Sidik-Jonkman method for random effects meta-analysis is straightforward and considerably outperforms the standard DerSimonian-Laird method. *BMC Med Res Methodol* 2014;14:25, [doi:10.1186/1471-2288-14-25](https://doi.org/10.1186/1471-2288-14-25). Colditz GA, Brewer TF, Berkey CS, et al. Efficacy of BCG vaccine in the prevention of tuberculosis: meta-analysis of the published literature. *JAMA* 1994;271:698–702, [doi:10.1001/jama.1994.03510330076038](https://doi.org/10.1001/jama.1994.03510330076038). Viechtbauer W. Conducting meta-analyses in R with the metafor package. *J Stat Softw* 2010;36(3):1–48, [doi:10.18637/jss.v036.i03](https://doi.org/10.18637/jss.v036.i03).

## Worked example: does the BCG vaccine prevent tuberculosis?

The built-in data are the 13 BCG vaccine trials of Colditz et al. (1994), the standard example of meta-analysis software (metafor’s `dat.bcg`): tuberculosis cases and participants in the vaccinated and the control group of each trial.

**One study by hand.** Aronson 1948: 4 of 123 vaccinated and 11 of 139 controls developed tuberculosis. The risk ratio is \((4/123)/(11/139) = 0.411\); its log is −0.889 with variance \(1/4 - 1/123 + 1/11 - 1/139 = 0.326\), SE 0.571, so the 95% CI is \(e^{-0.889 \pm 1.96 \times 0.571}\) = 0.134 to 1.26.

| Quantity | Value |
| --- | --- |
| Pooled risk ratio (95% CI) | 0.4894 (0.3441 to 0.6962), z = −3.97, P < 0.0001 |
| Fixed effect, Mantel–Haenszel | 0.6353 (0.5881 to 0.6862) |
| τ² (between-study variance) | 0.3132 |
| I² | 92.2% (95% CI 81.9% to 97.7%) |
| Cochran’s Q | 152.2 with 12 df, P < 0.0001 |
| 95% prediction interval | 0.134 to 1.79 |
| Egger’s test | intercept −2.11, P = 0.19 |

**How to read it.** On average the vaccine roughly halves the risk of tuberculosis (a 51% reduction). But the trials disagree far more than chance allows (I² = 92%), and the prediction interval runs from a strong benefit (0.13) to none (1.79): the effect depends on the setting. Colditz et al. traced much of it to latitude, which is why a single pooled number should not be read alone. Egger’s test does not show funnel asymmetry.

| Your studies report | Layout | Measure |
| --- | --- | --- |
| Number of events and participants per group | Events and totals | Risk ratio (or odds ratio, risk difference) |
| Mean, SD and N per group, same scale | Means, SDs, Ns | Mean difference |
| Means on different scales | Means, SDs, Ns | Hedges’ g |
| Odds, risk or hazard ratio with 95% CI | Effect and 95% CI | Ratios (pooled on the log scale) |
| A coefficient or log ratio with its SE | Effect and SE | Differences |



## Questions

### How do I make a forest plot for a meta-analysis?

Choose what your studies report, paste one row per study (name first), and pick the measure. The tool pools the studies and draws the forest plot with each study’s effect and 95% CI, squares sized by weight and the pooled diamond. Download it as a 300 or 600 dpi PNG or open it in the LabCanvas Graph app to style it.

### Fixed effect or random effects?

Random effects is the usual choice: it assumes the true effect varies between studies and gives a wider, more honest CI when it does. Fixed effect assumes one true effect shared by all studies, which suits near-identical studies. With I² well above 0, random effects is the safer default.

### What does I² mean?

The share of the variation in study effects that reflects real differences rather than chance. Roughly, 25% is low, 50% moderate and 75% high heterogeneity (Higgins et al. 2003). It does not say how large the differences are: τ² and the prediction interval do.

### How do I pool odds ratios or hazard ratios from papers?

Use the effect and 95% CI layout with “Ratios”. The tool takes logs, gets each SE from the CI width (upper − lower on the log scale divided by 3.92), pools on the log scale and shows the result back as a ratio.

### Why is the prediction interval wider than the confidence interval?

The confidence interval is about the average effect; the prediction interval is about the effect in a new study, so it adds the between-study variance τ². With high heterogeneity it can include no effect even when the average effect is clear.

### How many studies do I need?

Two is the minimum to pool, but τ² is poorly estimated with fewer than about five studies (use the Hartung–Knapp option) and Egger’s test needs about ten.
