Meta-analysis of study estimates (fixed or random effects)
stats_meta_analysis
Pools study estimates by fixed-effect or random-effects meta-analysis.
- Runs
- On the server
- Level
- Checked against a reference: statsmodels 0.15.0 combine_effects (DerSimonian–Laird), Higgins 2003 and 2009's printed values and an 80-digit second implementation in Python
What it is
Returns an inverse-variance fixed-effect or DerSimonian–Laird random-effects pooled estimate, with Q, I² and τ². Use when combining one estimate and its standard error from each of several independent studies, as a difference or as a ratio such as an odds, risk or hazard ratio. Not for a single study: use `stats_contingency_table` for one table of counts or use `stats_compare_groups` for one set of groups. Model, scale, level and independence are required with no default; a non-small Q p or a low I² does not show the studies agree, and no model is recommended. A measurement's unit is required, never assumed: any unit of the kit's table, returned in its canonical spelling; a unit group takes one unit, never converted.
Field: Statistics and design.
What it does
You give
model(required): 'fixed' (inverse-variance fixed effect: one common effect assumed) or 'random-dersimonian-laird' (random effects, between-study variance τ² by DerSimonian–Laird). Required, no default; never chosen from the heterogeneity.scale(required): 'difference' (estimates in their own unit, e.g. a mean difference) or 'log-ratio' (estimates as ratios such as odds, risk or hazard ratios, each above 0; pooled on the natural log).independence(required): Whether the studies are independent of one another: 'independent' (no shared arm, participant or cohort; opens the pooled SE, interval, z and p, Q, df, Q's p, I², τ², τ, the random-effects estimate and weights, and the prediction interval), 'overlapping' (a shared control arm, a multi-arm trial entered more than once, or one cohort reported in more than one study) or 'unspecified'. Required, no default: never inferred.studies(required): The studies: names, estimates and standard errors, one each per study.level(required): Confidence level of the Wald intervals: 0.9, 0.95 or 0.99 (or 90, 95, 99 %). Must be above 0 and below 1.
No request is recorded for this tool.
Limits
- Research statistics and experimental-design arithmetic on the data, margins, prevalence and settings you supply.
- Not for diagnosis or treatment decisions and not a regulatory analysis.
- It does not choose a design, a margin, a cut-off or a sample size for you.
- One summary estimate and its standard error per study, at most 200 studies; the pooled SE, interval and p, Q, I², τ², and the random-effects estimate and weights only for studies you declare independent (no shared arm, no cohort counted twice).
- Fixed effect, or DerSimonian–Laird random effects (the Cochrane Handbook notes versions with better statistical properties and reports simulation studies recommending Paule–Mandel or REML), with z-based intervals that can be too narrow when studies are few.
- No REML, Hartung–Knapp, or intervals for τ² or I²; a prediction interval (t on k − 2 df, Higgins 2009) only from 5 studies, which differs from the Handbook's k − 1 and RevMan's z.
- No SEs derived from published intervals; no counts or means as input.
- No meta-regression, subgroups or bias tests.
- Q has little power with few studies and I² is then uncertain: neither shows that the studies agree.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
It will not answer when
- the names, estimates and standard errors differ in length.
- a ratio at or below 0 on 'log-ratio'.
- a standard error below 1e-75 or above 1e75: double precision cannot then square and weight every SE (their ratio is then at most 1e150, so every relative weight is at least 1e-300; Drybench's A4 ruling of 11 November 2026, item 2; the code is a placeholder until Drybench names it).
Every input, with its units5 inputs
model(required): 'fixed' (inverse-variance fixed effect: one common effect assumed) or 'random-dersimonian-laird' (random effects, between-study variance τ² by DerSimonian–Laird). Required, no default; never chosen from the heterogeneity.scale(required): 'difference' (estimates in their own unit, e.g. a mean difference) or 'log-ratio' (estimates as ratios such as odds, risk or hazard ratios, each above 0; pooled on the natural log).independence(required): Whether the studies are independent of one another: 'independent' (no shared arm, participant or cohort; opens the pooled SE, interval, z and p, Q, df, Q's p, I², τ², τ, the random-effects estimate and weights, and the prediction interval), 'overlapping' (a shared control arm, a multi-arm trial entered more than once, or one cohort reported in more than one study) or 'unspecified'. Required, no default: never inferred.studies(required): The studies: names, estimates and standard errors, one each per study.level(required): Confidence level of the Wald intervals: 0.9, 0.95 or 0.99 (or 90, 95, 99 %). Must be above 0 and below 1.
Every refusal, with its code3 refusals
| Code | When |
|---|---|
LENGTHS_DIFFER | the names, estimates and standard errors differ in length. |
NONPOSITIVE_ON_LOG | a ratio at or below 0 on 'log-ratio'. |
SE_RANGE_NOT_REPRESENTABLE | a standard error below 1e-75 or above 1e75: double precision cannot then square and weight every SE (their ratio is then at most 1e150, so every relative weight is at least 1e-300; Drybench's A4 ruling of 11 November 2026, item 2; the code is a placeholder until Drybench names it). |
The calculation
The method's equations, constants and worked example.
Equation 1
θ̂_IV = Σwᵢθ̂ᵢ / Σwᵢ
SE(θ̂_IV) = 1/√Σwᵢ (weights carried relative to the smallest SE and estimates centred on the first study's: Our derivation, the same quantities without overflow or cancellation)
| Symbol | Meaning |
|---|---|
θ̂ᵢ | study estimate on the analysis scale (in the estimates' unit, or ln of the ratio), as-given |
wᵢ | inverse-variance weight; the reply's weight is 100% × wᵢ/Σwⱼ with the model's weights (wᵢ fixed, wᵢ′ random), 1/as-given^2 |
SEᵢ | its standard error (in the estimates' unit, or ln of the ratio), as-given |
Source 1.
Equation 2
Q = Σwᵢ(θ̂ᵢ − θ̂_IV)², summed from the deviations (never as Σwθ² − (Σwθ)²/Σw), χ² on k − 1 df under no differences, in both models
Q's p = P(χ²_{k−1} ≥ Q)
| Symbol | Meaning |
|---|---|
Q | Cochran's Q |
k | studies |
Source 1.
Equation 3
I² = 100% × (Q − df)/Q with negative values put equal to 0, so that I² lies between 0% and 100%
reported as 0 whenever Q ≤ k − 1, Q = 0 included (Our convention: the source's limit at Q = 0)
| Symbol | Meaning |
|---|---|
df | k − 1 |
Source 2.
Equation 4
a prediction interval only from k ≥ 5 studies
below, withheld (TOO_FEW_STUDIES)
| Symbol | Meaning |
|---|---|
k | studies |
Source 3.
Equation 5
τ̂² = max((Q − (k − 1)) / (Σwᵢ − Σwᵢ²/Σwᵢ), 0), the denominator computed as Σwᵢ(S − wᵢ)/S with S = Σwᵢ (Our derivation: the same quantity without cancellation when one weight dominates)
wᵢ′ = 1/(SEᵢ² + τ̂²)
θ̂_DL = Σwᵢ′θ̂ᵢ / Σwᵢ′
SE(θ̂_DL) = 1/√Σwᵢ′
with τ̂² = 0 the weights and results are the fixed-effect ones
| Symbol | Meaning |
|---|---|
τ̂² | between-study variance (in the caller's unit squared); the reply's tau2Truncated is true when Q < k − 1 and τ̂² was set to 0, as-given^2 |
Source 1.
Equation 6
interval θ̂ ± z₍₁₊ₗ₎/₂ × SE (the source prints the deviate as "Φ(1 − α/2)", read as the quantile Φ⁻¹(1 − α/2))
Z = θ̂/SE with the two-sided normal p
on 'log-ratio' the estimate and limits are exponentiated
each study's own interval likewise from its SE
| Symbol | Meaning |
|---|---|
l | the caller's level |
Source 1.
Equation 7
random mode, k ≥ 5: μ̂ ± t₍ₖ₋₂₎ √(τ̂² + SE(μ̂)²), μ̂ = θ̂_DL and SE(μ̂) = SE(θ̂_DL), t at (1 + l)/2 for the caller's level l, with the DerSimonian–Laird τ̂² above. The Cochrane Handbook 6.5.1 §10.10.4.3 prints k − 1 and RevMan with Wald intervals uses z, so values differ from both
| Symbol | Meaning |
|---|---|
t₍ₖ₋₂₎ | Student's t quantile on k − 2 df |
Source 4.
Conventions
- model = fixed: The inverse-variance weighted mean of the study estimates, one common effect assumed; no τ², τ or prediction interval: the fixed model has no between-study variance.
- model = random-dersimonian-laird: The mean of a normal distribution of study effects, each study weighted by 1/(SE² + τ̂²) with τ̂² by DerSimonian–Laird; not a common effect.
- scale = difference: Estimates pooled as given, in their own unit.
- scale = log-ratio: Ratios pooled on the natural log; the estimate and limits are returned as ratios, the SE, τ and τ² on the log scale.
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of stats-meta-analysis@2.0.1, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- model = random-dersimonian-laird
- scale = difference
- independence = independent
- level = 0.95
- studies.names[0] = A
- studies.names[1] = B
- studies.names[2] = C
- studies.estimates[0] = 0
- studies.estimates[1] = 2
- studies.estimates[2] = 4
- studies.standardErrors[0] = 1
- studies.standardErrors[1] = 1
- studies.standardErrors[2] = 1
Steps
- w = 1, from studies.standardErrors; by equation 1.
- theta-iv = 2, from studies.estimates, w; by equation 1.
- q = 8, from studies.estimates, theta-iv, w; by equation 2; gives heterogeneity.q.
- i2 = 75 %, from q; by equation 3; gives heterogeneity.i2.
- tau2 = 3, from q, w; by equation 5; gives heterogeneity.tau2.
- theta-dl = 2, from studies.estimates, tau2; by equation 5; gives estimate.
- se-dl = 1.1547005, from tau2; by equation 5; gives standardError.
- z = 1.7320508, from theta-dl, se-dl; by equation 6; gives z.
The working, as the case writes it:
By hand: SEs all 1, so wᵢ = 1 and Σw = 3. θ̂_IV = (0 + 2 + 4)/3 = 2
SE = 1/√3
Q = 4 + 0 + 4 = 8 on 2 df
I² = (8 − 2)/8 = 75 %
DL denominator 3 − 3/3 = 2, τ̂² = (8 − 2)/2 = 3
wᵢ′ = 1/(1 + 3) = 1/4, so θ̂_DL = 2, SE = 1/√(3/4) = 2/√3, τ = √3, z = 2/(2/√3) = √3, weights 1/3 each (Deeks and Higgins 2022, pp. 6 and 8).
Answer
heterogeneity.q = 8
heterogeneity.i2 = 75 %
heterogeneity.tau2 = 3
estimate = 2
standardError = 1.1547005
z = 1.7320508
Where these values came from: an outside program, mpmath mpmath 1.4.1; mpmath 1.4.1 at 50 digits.
At build the tool returned this answer within the tolerance the file states: relative 1e-12 against the 50-digit transcription (near zero, 1e-15 absolute below 1e-3 in the value's unit); on the log scale (SE, τ in ln(1), τ² in ln(1)^2) 1e-13 absolute; counts, df, names, codes, statuses and tau2Truncated exact.
Sources
Deeks JJ, Higgins JPT, on behalf of the Statistical Methods Group of The Cochrane Collaboration. Statistical algorithms in Review Manager 5. August 2010
Used for: Inverse-variance meta-analysis of study estimates: fixed effect or DerSimonian–Laird random effects. At: section p. 6, the inverse-variance weights and eqs (7) and (8); section p. 6, Q_IV, its χ² reference and I²; Higgins et al. 2003, the I² definition with negatives set to 0; section p. 8, the DerSimonian and Laird τ̂², the random-effects weights and eqs (13) and (14), and the note that Q ≤ k − 1 gives τ̂² = 0; section p. 8, Confidence intervals; p. 9, Test for presence of an overall intervention effect.
Read in full, 14 November 2026Higgins JPT, Thompson SG, Deeks JJ, Altman DG. Measuring inconsistency in meta-analyses. BMJ 2003;327:557–560
Used for: Inverse-variance meta-analysis of study estimates: fixed effect or DerSimonian–Laird random effects. At: section the paragraph defining I² ("Negative values of I2 are put equal to zero"), and Tables 1 and 2.
Read in full, 11 November 2026Deeks JJ, Higgins JPT, Altman DG, McKenzie JE, Veroniki AA, Simmonds M (editors). Chapter 10: Analysing data and undertaking meta-analyses. Cochrane Handbook for Systematic Reviews of Interventions version 6.5.1, 2026
Used for: Inverse-variance meta-analysis of study estimates: fixed effect or DerSimonian–Laird random effects. At: section §10.10.4.3: "can be very problematic when the number of studies is small … we encourage their use when the number of studies is reasonable (e.g. five or more"; §10.10.4.4 for RevMan's z multiplier with Wald intervals.
Read in full, 11 November 2026Higgins JPT, Thompson SG, Spiegelhalter DJ. A re-evaluation of random-effects meta-analysis. J R Stat Soc A 2009;172(1):137–159
Used for: Inverse-variance meta-analysis of study estimates: fixed effect or DerSimonian–Laird random effects. At: section §5.4, eqs (11) and (12): "the 100(1−α/2)% percentile of the t-distribution with k−2 degrees of freedom"; the floor of five studies from the Cochrane Handbook §10.10.4.3 ("we encourage their use when the number of studies is reasonable (e.g. five or more").
Read in full, 11 November 2026
How it is checked
- Level
Checked against a reference.
- Checked against
An outside program, mpmath, mpmath 1.4.1; an outside program, statsmodels combine_effects; SciPy, statsmodels 0.15.0; scipy 1.18.1; the source's own worked example, printed values; mpmath for the unprinted values and the propagation, mpmath 1.4.1; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, mpmath 1.4.1 at 80 decimal digits, rounded once to double; the normal and t quantiles from SciPy 1.18.1's distribution functions; not an outside program.
- Cases
No case set is linked to this version.
- Not checked
The DerSimonian–Laird estimator is named as given in Deeks and Higgins's RevMan algorithms (the August 2010 edition, re-read at source on 14 November 2026; the May 2022 edition, read once by the builder on 11 November 2026 and not re-read): DerSimonian and Laird 1986 is not read. Hartung–Knapp, REML and Paule–Mandel, intervals for τ² or I², inputs from counts or from means and SDs, and SEs derived from published intervals are not offered.
What was not checked, in fullfrom the method records
- The DerSimonian–Laird estimator is named as given in Deeks and Higgins's RevMan algorithms (the August 2010 edition, re-read at source on 14 November 2026; the May 2022 edition, read once by the builder on 11 November 2026 and not re-read): DerSimonian and Laird 1986 is not read.
- Hartung–Knapp, REML and Paule–Mandel, intervals for τ² or I², inputs from counts or from means and SDs, and SEs derived from published intervals are not offered.
- The prediction interval's multiplier is a judgement among three published choices (t on k − 2, t on k − 1, z); Higgins 2009's Table 1 cannot tell t(k − 2) from t(k − 1) or z; the Whitehead and Whitehead estimator of that table is taken as the DerSimonian–Laird moment estimator from the numbers, not from a read source.
- Higgins 2009 Table 1's printed P = 0.02 (Q = 16.73 on 13 df gives 0.21) and its "credible interval" for a classical interval are source anomalies, not asserted.
- Coverage of the intervals is not checked.
- The copy's claims rest on the Cochrane Handbook 6.5.1, chapter 10: §10.10.2 (the χ² test's low power with few or small studies; "a non-significant result must not be taken as evidence of no heterogeneity"), §10.10.4.4 (the Wald interval "can yield overly narrow confidence intervals … particularly when there are few studies") and §10.10.4.5 ("very likely to be too narrow" with two or three studies), §10.10.4.1 ("The choice between a fixed-effect and a random-effects meta-analysis should never be made on the basis of a statistical test for heterogeneity"), §10.10.4.4 (I² = Tau²/(Tau² + the typical within-study variance), which equals the Q form under DerSimonian–Laird: I² is relative to the studies' precision) and MECIR C63, Box 10.10.b ("use of simple thresholds to diagnose heterogeneity should be avoided").
Changes to its methods1 change
- 21 November 2026, stats-meta-analysis@2.0.1: In 2.0.1 the normal tail at such z is the 0 it rounds to (the incomplete gamma's leading factor rounds to 0 and the fraction, at most 1/(x−a+1) for a ≥ 1 (8.2.2), at most 1/x for a ≤ 1 (8.10.1); below 1 in both, is not run), so those calls are computed, with p withheld as P_BELOW_FLOOR. Every value the function returned as a number is unchanged in every bit, and every case of the method's fixtures keeps its output hash.