BMeta-analysis · meta.pool
Meta-analysis (pool studies, heterogeneity)
What is the average effect across studies, and how much do the studies' true effects differ?
Pools study results — two-arm counts, means, correlations, estimates with standard errors or ratios with confidence intervals — in a random-effects (REML, ML, DerSimonian–Laird, Hedges, Sidik–Jonkman, Paule–Mandel, empirical Bayes) or common-effect model, with Wald or Knapp–Hartung inference, Mantel–Haenszel or Peto pooling for counts, Cochran's Q, τ² and I² with Q-profile intervals, and the prediction interval for a new study's true effect.
A real result
Example “Bcg rr reml”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
risk ratio = 0.49, 95% CI [0.34, 0.70], p < .001; Q(12) = 152.23, p < .001, I² = 92.2%
- Pooled risk ratio
- 0.4894
- p
- < .001
- Cochran's Q
- 152.23
- p (heterogeneity)
- < .001
- τ²
- 0.3132
- I² (%)
- 92.221
Effect size
- Pooled risk ratio 0.4894 95% CI [0.3441, 0.6962]
Plots
View data
| risk ratio | high | row | study | low | weight % |
|---|---|---|---|---|---|
| 0.4109 | 1.257 | study | Aronson 1948 | 0.1343 | 5.059 |
| 0.2049 | 0.4864 | study | Ferguson & Simes 1949 | 0.0863 | 6.365 |
| 0.2597 | 0.9186 | study | Rosenthal et al 1960 | 0.0734 | 4.436 |
| 0.2366 | 0.3121 | study | Hart & Sutherland 1977 | 0.1793 | 9.699 |
| 0.8045 | 1.254 | study | Frimodt-Moller et al 1973 | 0.5163 | 8.868 |
| 0.4556 | 0.5362 | study | Stein & Aronson 1953 | 0.3871 | 10.096 |
| 0.1977 | 0.4989 | study | Vandiviere et al 1973 | 0.0784 | 6.027 |
| 1.012 | 1.145 | study | TPT Madras 1980 | 0.8946 | 10.189 |
| 0.6254 | 0.9962 | study | Coetzee & Berjak 1968 | 0.3926 | 8.743 |
| 0.2538 | 0.4310 | study | Rosenthal et al 1961 | 0.1494 | 8.368 |
| 0.7122 | 0.8860 | study | Comstock et al 1974 | 0.5725 | 9.925 |
| 1.562 | 6.528 | study | Comstock & Webster 1969 | 0.3737 | 3.822 |
| 0.9828 | 1.659 | study | Comstock et al 1976 | 0.5821 | 8.403 |
| 0.4894 | 0.6962 | summary | Pooled (RE) | 0.3441 | 100 |
View data
| log risk ratio | study | standard error |
|---|---|---|
| −0.8893 | Aronson 1948 | 0.5706 |
| −1.585 | Ferguson & Simes 1949 | 0.4411 |
| −1.348 | Rosenthal et al 1960 | 0.6445 |
| −1.442 | Hart & Sutherland 1977 | 0.1415 |
| −0.2175 | Frimodt-Moller et al 1973 | 0.2263 |
| −0.7861 | Stein & Aronson 1953 | 0.0831 |
| −1.621 | Vandiviere et al 1973 | 0.4722 |
| 0.0120 | TPT Madras 1980 | 0.0629 |
| −0.4694 | Coetzee & Berjak 1968 | 0.2376 |
| −1.371 | Rosenthal et al 1961 | 0.2702 |
| −0.3394 | Comstock et al 1974 | 0.1114 |
| 0.4459 | Comstock & Webster 1969 | 0.7297 |
| −0.0173 | Comstock et al 1976 | 0.2672 |
View data
| study | precision (1/SE) | standardized estimate |
|---|---|---|
| Aronson 1948 | 1.753 | −1.559 |
| Ferguson & Simes 1949 | 2.267 | −3.594 |
| Rosenthal et al 1960 | 1.552 | −2.092 |
| Hart & Sutherland 1977 | 7.069 | −10.191 |
| Frimodt-Moller et al 1973 | 4.419 | −0.9613 |
| Stein & Aronson 1953 | 12.034 | −9.460 |
| Vandiviere et al 1973 | 2.118 | −3.432 |
| TPT Madras 1980 | 15.888 | 0.1899 |
| Coetzee & Berjak 1968 | 4.209 | −1.976 |
| Rosenthal et al 1961 | 3.701 | −5.075 |
| Comstock et al 1974 | 8.976 | −3.046 |
| Comstock & Webster 1969 | 1.370 | 0.6111 |
| Comstock et al 1976 | 3.742 | −0.0648 |
View data
| study | risk, group 1 | risk, group 2 | participants |
|---|---|---|---|
| Aronson 1948 | 0.0325 | 0.0791 | 262 |
| Ferguson & Simes 1949 | 0.0196 | 0.0957 | 609 |
| Rosenthal et al 1960 | 0.0130 | 0.0500 | 451 |
| Hart & Sutherland 1977 | 0.0046 | 0.0193 | 26,465 |
| Frimodt-Moller et al 1973 | 0.0065 | 0.0081 | 10,877 |
| Stein & Aronson 1953 | 0.1168 | 0.2564 | 2,992 |
| Vandiviere et al 1973 | 0.0031 | 0.0159 | 3,174 |
| TPT Madras 1980 | 0.0057 | 0.0056 | 176,782 |
| Coetzee & Berjak 1968 | 0.0039 | 0.0062 | 14,776 |
| Rosenthal et al 1961 | 0.0099 | 0.0390 | 3,381 |
| Comstock et al 1974 | 0.0037 | 0.0052 | 77,972 |
| Comstock & Webster 1969 | 0.0020 | 0.0013 | 4,839 |
| Comstock et al 1976 | 0.0016 | 0.0016 | 34,767 |
Assumptions
- Enough studies — 13 studies.
- Heterogeneity — Q(12) = 152.23, p < .001; I² = 92.2%.
- Independent estimates — One estimate per study is assumed; several outcomes from one study need a multilevel model.
Studies (risk ratio, 95% CI)
| Study | Estimate | CI low | CI high | Weight % |
|---|---|---|---|---|
| Aronson 1948 | 0.4109 | 0.1343 | 1.257 | 5.059 |
| Ferguson & Simes 1949 | 0.2049 | 0.0863 | 0.4864 | 6.365 |
| Rosenthal et al 1960 | 0.2597 | 0.0734 | 0.9186 | 4.436 |
| Hart & Sutherland 1977 | 0.2366 | 0.1793 | 0.3121 | 9.699 |
| Frimodt-Moller et al 1973 | 0.8045 | 0.5163 | 1.254 | 8.868 |
| Stein & Aronson 1953 | 0.4556 | 0.3871 | 0.5362 | 10.096 |
| Vandiviere et al 1973 | 0.1977 | 0.0784 | 0.4989 | 6.027 |
| TPT Madras 1980 | 1.012 | 0.8946 | 1.145 | 10.189 |
| Coetzee & Berjak 1968 | 0.6254 | 0.3926 | 0.9962 | 8.743 |
| Rosenthal et al 1961 | 0.2538 | 0.1494 | 0.4310 | 8.368 |
| Comstock et al 1974 | 0.7122 | 0.5725 | 0.8860 | 9.925 |
| Comstock & Webster 1969 | 1.562 | 0.3737 | 6.528 | 3.822 |
| Comstock et al 1976 | 0.9828 | 0.5821 | 1.659 | 8.403 |
Heterogeneity
| Estimate | CI low | CI high | |
|---|---|---|---|
| τ² | 0.3132 | 0.1197 | 1.111 |
| τ | 0.5597 | 0.3460 | 1.054 |
| I² (%) | 92.221 | 81.921 | 97.678 |
| H² | 12.856 | — | — |
- Prediction interval for a new study's true effect: [0.134, 1.78].
- The z test ignores the uncertainty in τ²: with no effect it rejected 8.7% at the 5% level with 20 studies in simulation. Knapp–Hartung allows for it.
risk ratio = 0.49, 95% CI [0.34, 0.70], p < .001; Q(12) = 152.23, p < .001, I² = 92.2%
- Pooled risk ratio
- 0.4894
- p
- < .001
- Cochran's Q
- 152.23
- p (heterogeneity)
- < .001
- τ²
- 0.3132
- I² (%)
- 92.221
Effect size
- Pooled risk ratio 0.4894 95% CI [0.3441, 0.6962]
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Enough studies — 13 studies.
- Heterogeneity — Q(12) = 152.23, p < .001; I² = 92.2%.
- Independent estimates — One estimate per study is assumed; several outcomes from one study need a multilevel model.
Studies (risk ratio, 95% CI)
| Study | Estimate | CI low | CI high | Weight % |
|---|---|---|---|---|
| Aronson 1948 | 0.4109 | 0.1343 | 1.257 | 5.059 |
| Ferguson & Simes 1949 | 0.2049 | 0.0863 | 0.4864 | 6.365 |
| Rosenthal et al 1960 | 0.2597 | 0.0734 | 0.9186 | 4.436 |
| Hart & Sutherland 1977 | 0.2366 | 0.1793 | 0.3121 | 9.699 |
| Frimodt-Moller et al 1973 | 0.8045 | 0.5163 | 1.254 | 8.868 |
| Stein & Aronson 1953 | 0.4556 | 0.3871 | 0.5362 | 10.096 |
| Vandiviere et al 1973 | 0.1977 | 0.0784 | 0.4989 | 6.027 |
| TPT Madras 1980 | 1.012 | 0.8946 | 1.145 | 10.189 |
| Coetzee & Berjak 1968 | 0.6254 | 0.3926 | 0.9962 | 8.743 |
| Rosenthal et al 1961 | 0.2538 | 0.1494 | 0.4310 | 8.368 |
| Comstock et al 1974 | 0.7122 | 0.5725 | 0.8860 | 9.925 |
| Comstock & Webster 1969 | 1.562 | 0.3737 | 6.528 | 3.822 |
| Comstock et al 1976 | 0.9828 | 0.5821 | 1.659 | 8.403 |
Heterogeneity
| Estimate | CI low | CI high | |
|---|---|---|---|
| τ² | 0.3132 | 0.1197 | 1.111 |
| τ | 0.5597 | 0.3460 | 1.054 |
| I² (%) | 92.221 | 81.921 | 97.678 |
| H² | 12.856 | — | — |
- Prediction interval for a new study's true effect: [0.134, 1.78].
- The z test ignores the uncertainty in τ²: with no effect it rejected 8.7% at the 5% level with 20 studies in simulation. Knapp–Hartung allows for it.
Do it in CodeSplash Run it on your own data, in Python or R, with the code to prove it.
Worked examples in the app
- Bcg rr remlm1_bcg · events_1: events_1 · events_2: events_2 · study: trial · total_1: total_1 · total_2: total_2
- Bcg or dl knham1_bcg · events_1: events_1 · events_2: events_2 · study: trial · total_1: total_1 · total_2: total_2
- Bcg mh rrm1_bcg · events_1: events_1 · events_2: events_2 · study: trial · total_1: total_1 · total_2: total_2
- Bcg petom1_bcg · events_1: events_1 · events_2: events_2 · study: trial · total_1: total_1 · total_2: total_2
- Normand smd pmm1_normand · mean_1: mean_1 · mean_2: mean_2 · sd_1: sd_1 · sd_2: sd_2 · study: source · total_1: total_1 · total_2: total_2
- Molloy zcor sjm1_molloy · n: n · r: r · study: study
- Raudenbush generic mlm1_raudenbush · effect: effect · se: se · study: study
- Hackshaw ratio ci hem1_hackshaw · ci_high: or_high · ci_low: or_low · effect: or · study: study
In the guides
Tests from the statistics guide this method runs
What you need
- Study labels (optional)categorical · 0–1 column
- Names the studies in tables and the forest plot.
- Estimate (or ratio)numeric · 0–1 column
- Generic: each study's estimate on an additive scale (log OR, SMD …). With CI limits: the ratio itself (OR, RR, HR).
- Standard errornumeric · 0–1 column
- Generic design: the estimate's standard error.
- Lower CI limit (ratio)numeric · 0–1 column
- Ratio with CI design: the reported lower limit; the SE comes from the CI width on the log scale.
- Upper CI limit (ratio)numeric · 0–1 column
- Ratio with CI design: the reported upper limit.
- Events, group 1numeric · 0–1 column
- Two-arm counts: events in the first (treatment) arm.
- Total, group 1numeric · 0–1 column
- Participants in the first arm (counts and means designs).
- Events, group 2numeric · 0–1 column
- Two-arm counts: events in the second (control) arm.
- Total, group 2numeric · 0–1 column
- Participants in the second arm (counts and means designs).
- Mean, group 1numeric · 0–1 column
- Means design: mean of the first arm.
- SD, group 1numeric · 0–1 column
- Means design: standard deviation of the first arm (not the SE).
- Mean, group 2numeric · 0–1 column
- Means design: mean of the second arm.
- SD, group 2numeric · 0–1 column
- Means design: standard deviation of the second arm.
- Correlationnumeric · 0–1 column
- Correlation design: each study's Pearson r.
- Sample size (correlation)numeric · 0–1 column
- Correlation design: the number of pairs behind each r.
Choices you make
hypothesis
- Study datadefault auto
What each row reports. Auto picks it from the columns you bound.
- Detect from the columns(default) — Counts → two-arm counts; means → means; r → correlations; CI limits → ratio with CI; else estimate + SE.
- Two-arm counts — Each study gives events and totals in two arms; pick it for yes/no outcomes.
- Means and SDs — Each study gives means, SDs and sizes in two arms; pick it for numeric outcomes.
- Correlations — Each study gives a correlation and its sample size; pick it for associations.
- Ratio with CI — Each study gives a ratio with its CI, worked back to a log-scale SE; pick it for published OR, RR or HR.
- Estimate and SE — Each study gives an estimate and its SE; pick it when effects are already computed.
- Effect measuredefault auto
The scale studies are pooled on (ratios on the log scale and reported back as ratios).
- Default for the data(default) — Odds ratio for counts, Hedges' g for means, Fisher's z for correlations.
- Odds ratio — Odds ratio from two-arm counts; steady across baseline risks, and the usual choice for rare events.
- Risk ratio — Risk ratio from two-arm counts; easier to explain than odds, on a ratio scale.
- Risk difference — Risk difference from two-arm counts; gives the absolute effect, which often varies more across studies.
- Standardized mean difference (Hedges' g) — Mean difference in SD units (Hedges' g); pick it when studies use different scales.
- Mean difference — Raw units; only when every study measured the outcome on the same scale.
- Fisher's z (reported as r) — Transforms correlations by Fisher's z before pooling and reports r; the usual choice for correlations.
- Raw correlation — Pools correlations on their raw scale; easy to read, but each one's variance depends on r.
- Modeldefault random
Random effects lets true effects vary between studies; common effect assumes one true effect for all.
- Random effects(default) — True effects vary between studies; the pooled value is their mean.
- Common effect (fixed) — One true effect shared by every study; inference applies only to these studies.
- Confidence leveldefault 0.95
How sure the intervals should be: 0.95 gives 95% confidence intervals. Higher confidence means wider intervals.
statistics
- τ² estimatordefault REML
How the between-study variance is estimated; REML and Paule–Mandel are the usual recommendations.
- Restricted maximum likelihood (REML)(default) — Estimates between-study variance by restricted likelihood; the recommended all-rounder.
- Paule–Mandel — Chooses τ² so Cochran's Q matches its expected value; a good alternative to REML, also for binary outcomes.
- DerSimonian–Laird — Classic method-of-moments; underestimates τ² with few studies.
- Maximum likelihood — Uses the full likelihood; needed to compare moderator models, though τ² runs low with few studies.
- Hedges (unweighted moments) — An unweighted moment estimate; easy to compute, but noisy when studies differ in size.
- Sidik–Jonkman — Starts from a rough τ² and refines it once; rarely gives zero, and overestimates when heterogeneity is low.
- Empirical Bayes (Morris) — An empirical Bayes estimate; gives the same answer as Paule–Mandel when there are no moderators.
- Inferencedefault z
Knapp–Hartung (HKSJ) uses a t distribution with an adjusted SE; better coverage with few studies.
- Wald z(default) — Uses the normal distribution; fine with many studies, but intervals run narrow with few.
- Knapp–Hartung t — Uses a t distribution with an adjusted SE; better coverage with few studies.
- Never shrink the Knapp–Hartung SEdefault off
Modified Knapp–Hartung: use max(1, q) so the interval is never narrower than Wald. Without it, k = 10 rejected about 7.5% at 5% in simulation.
- Pooling (counts)default inverse_variance
Mantel–Haenszel and Peto pool two-arm counts without a continuity correction (common-effect models).
- Inverse variance(default) — Weights each study by the inverse of its variance; works with any effect measure.
- Mantel–Haenszel — Pools the 2×2 tables directly; steadier when events are sparse, for odds and risk measures only.
- Peto odds ratio — Rare events with balanced arms only.
- Prediction intervaldefault t
Higgins et al. use t with k − 2 degrees of freedom.
- t, k − 2 df(default) — Uses t with k − 2 degrees of freedom (Higgins et al.); wider and better with few studies, so it's the usual choice.
- Normal — Uses the normal distribution; narrower, and fine with many studies.
options
- Zero cellsdefault only0
Continuity correction for log OR / RR when a study has a zero cell.
- Add ½ to studies with a zero cell(default) — Adds ½ to the cells of studies with a zero; the usual choice.
- Add ½ to every study — Adds ½ to every study's cells; matches some older software, and pulls small studies towards no effect.
- No correction (drop undefined) — Adds nothing, so studies with an undefined effect drop out; pick it as a sensitivity check.
- Leave out double-zero studiesdefault on
Studies with no events (or only events) in both arms carry no information about OR or RR.
- Reported CI level (ratio design)default 0.95
The level of the confidence intervals the studies reported (usually 95%).
Checks and remedies
CodeSplash checks each testable assumption on every run and shows the result on the card; premises the data can’t test are marked. If a check fails, these are the ways forward.
Comparable studiesNot checked from data: state why it holds
Studies estimate the same kind of effect in comparable populations (the question is worth pooling).
Independent estimates
One estimate per study; several outcomes or arms from one study need a multilevel model.
Enough studies
τ² and the prediction interval are imprecise with fewer than about 10 studies; prefer Knapp–Hartung then.
Heterogeneity
Q tests only for heterogeneity; I² describes its share, τ the spread of true effects.
What it reports
- Tests: Pooled effect differs from zero
- Tests: Heterogeneity between studies (Cochran's Q)
- k
- How many groups, studies or clusters the analysis used. Many methods are less reliable when k is small.
- k_left_out
- The average effect across studies from a meta-analysis, weighted by each study's precision.
- est
- The average effect across studies from a meta-analysis, weighted by each study's precision.
- se
- The typical size of the error in an estimate, the standard deviation of its sampling distribution.
- stat
- A single number that summarizes how far your data are from what H₀ predicts.
- p
- How surprising your data would be if the null hypothesis were true, as a probability.
- ci_low
- A range of effect values compatible with your data at the chosen confidence level.
- ci_high
- A range of effect values compatible with your data at the chosen confidence level.
- est_bt
- The average effect across studies from a meta-analysis, weighted by each study's precision.
- ci_low_bt
- A range of effect values compatible with your data at the chosen confidence level.
- ci_high_bt
- A range of effect values compatible with your data at the chosen confidence level.
- tau2
- How much the studies' true effects vary around their mean; τ is the same on the effect's own scale.
- tau
- How much the studies' true effects vary around their mean; τ is the same on the effect's own scale.
- tau2_ci_low
- How much the studies' true effects vary around their mean; τ is the same on the effect's own scale.
- tau2_ci_high
- How much the studies' true effects vary around their mean; τ is the same on the effect's own scale.
- i2
- The share of the variation in study estimates that comes from real differences between studies rather than sampling error.
- i2_ci_low
- The share of the variation in study estimates that comes from real differences between studies rather than sampling error.
- i2_ci_high
- The share of the variation in study estimates that comes from real differences between studies rather than sampling error.
- h2
- The share of the variation in study estimates that comes from real differences between studies rather than sampling error.
- q
- The weighted sum of squared deviations of study estimates from the common-effect estimate; χ² with k − 1 df if all studies share one effect.
- q_df
- How much independent information is left to estimate variability after fitting the model.
- q_p
- The weighted sum of squared deviations of study estimates from the common-effect estimate; χ² with k − 1 df if all studies share one effect.
- pi_low
- Where the true effect of a new, comparable study would be expected to fall — wider than the CI of the mean whenever τ² > 0.
- pi_high
- Where the true effect of a new, comparable study would be expected to fall — wider than the CI of the mean whenever τ² > 0.
- pi_low_bt
- Where the true effect of a new, comparable study would be expected to fall — wider than the CI of the mean whenever τ² > 0.
- pi_high_bt
- Where the true effect of a new, comparable study would be expected to fall — wider than the CI of the mean whenever τ² > 0.
- measure
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
- measure_label
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
- effect_label
- Which group counts as first (or treated, or positive) decides the sign of differences and ratios on the card.
- model_label
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
Python and R
Python and R agree to 10 decimals (relative tolerance 1e-9). Python uses pandas, numpy, scipy, codesplash; R uses stats, nanoparquet, codesplashr.
Default traps between the two languages
- Random-effects tests with no effect (REML, τ = .2, SEs .1–.4): the z test rejects 8.7% at the 5% level with 20 studies, because it ignores the uncertainty in τ², and the card says so. Knapp–Hartung rejects about 7.5% with 10 studies, because q can shrink its interval below Wald's; 'Never shrink' is conservative. These match metafor's formulas.
- τ² estimators, Q-profile intervals and Mantel–Haenszel/Peto pooling are codesplash twins (Fisher scoring to |Δτ²| ≤ 1e-12, bisection to full precision), so the engines agree to ~1e-10. metafor stops REML/ML/PM/EB iterations at 1e-5, so its τ² can differ from these in the 5th–7th digit; its EB is the PM root reached by a different iteration.
The exact script CodeSplash ran for example “Bcg rr reml” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Meta-analysis (pool studies, heterogeneity)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.pool 1.0.3 · spec 6e902e32b28d2f2b
# Dataset: m1_bcg (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import numpy as np
import pandas as pd
from scipy import stats
import codesplash as cs
from codesplash.stats import meta # twins of codesplashr::cs_meta_*
# %% Data
df = pd.read_parquet("tests/parity/fixtures/m1_bcg.parquet", columns=["trial", "events_1", "total_1", "events_2", "total_2"])
n_input = len(df)
df["trial"] = pd.Categorical(df["trial"], categories=["Aronson 1948", "Ferguson & Simes 1949", "Rosenthal et al 1960", "Hart & Sutherland 1977", "Frimodt-Moller et al 1973", "Stein & Aronson 1953", "Vandiviere et al 1973", "TPT Madras 1980", "Coetzee & Berjak 1968", "Rosenthal et al 1961", "Comstock et al 1974", "Comstock & Webster 1969", "Comstock et al 1976"]) # stored level order
df = df.dropna(subset=["trial", "events_1", "total_1", "events_2", "total_2"]) # listwise deletion over the analysis columns
df["trial"] = df["trial"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["trial", "events_1", "total_1", "events_2", "total_2"]) # infinite values stop the run (registry/errors.yaml)
# %% Studies
design = "binary" # inferred from the bound columns
measure = "RR"
cols = {
"events_1": df["events_1"].to_numpy(dtype=float),
"total_1": df["total_1"].to_numpy(dtype=float),
"events_2": df["events_2"].to_numpy(dtype=float),
"total_2": df["total_2"].to_numpy(dtype=float),
}
es = meta.escalc(design, measure, cols, zero_cells="only0", drop00=True, ci_level=0.95)
measure = es["measure"]
labels_all = df["trial"].astype(str).tolist()
keep = es["keep"]
left_out = [labels_all[i] for i in np.flatnonzero(~keep)]
idx = np.flatnonzero(keep)
y, v = es["yi"][idx], es["vi"][idx]
labels = [labels_all[i] for i in idx]
k = len(y)
if k < 2:
cs.cs_error("CS_E_TOO_FEW_ROWS", what="A meta-analysis", min=2, n=k) # one usable study can't be pooled
if left_out:
warnings.append(f"Left out ({len(left_out)}): " + ", ".join(left_out) + (" — no events (or only events) in both arms." if design == "binary" else " — effect or variance not computable."))
bt = meta.back_transform(measure)
MEASURE_LABEL = {"GEN": "effect", "LOG": "log ratio", "OR": "log odds ratio", "RR": "log risk ratio", "RD": "risk difference",
"MD": "mean difference", "SMD": "Hedges' g", "ZCOR": "Fisher's z", "COR": "correlation"}[measure]
RATIO = measure in ("OR", "RR", "LOG")
# What a back-transformed number is: a ratio, not a log ratio; a correlation, not Fisher's z.
DISPLAY_LABEL = {"OR": "odds ratio", "RR": "risk ratio", "LOG": "ratio", "ZCOR": "correlation"}.get(measure, MEASURE_LABEL)
# %% Pool
conf = 0.95
model = "random"
pooling = "inverse_variance"
if pooling != "inverse_variance" and design != "binary":
raise ValueError("Mantel–Haenszel and Peto pooling need two-arm counts.")
if pooling == "peto":
measure, MEASURE_LABEL, DISPLAY_LABEL, RATIO, bt = "OR", "Peto log odds ratio", "Peto odds ratio", True, np.exp
fe = meta.rma(y, v, method="FE")
if pooling == "inverse_variance":
fit = meta.rma(y, v, method="FE" if model == "fixed" else "REML", test="z",
knha_trunc=False, level=conf)
est, se, stat, p = float(fit["beta"][0]), float(fit["se"][0]), float(fit["stat"][0]), float(fit["pval"][0])
ci_low, ci_high = float(fit["ci_low"][0]), float(fit["ci_high"][0])
tau2, q, q_df, q_p = fit["tau2"], fit["qe"], fit["qe_df"], fit["qe_p"]
weights = fit["weights"]
model_label = "common-effect model" if model == "fixed" else f"random effects, τ² by {fit['method']}" + (", Knapp–Hartung t" if fit["test"] == "knha" else "")
else:
a, n1, c, n2 = (es[key][idx] for key in ("events_1", "total_1", "events_2", "total_2"))
pooled = meta.mantel_haenszel(a, n1, c, n2, measure, level=conf) if pooling == "mantel_haenszel" else meta.peto(a, n1, c, n2, level=conf)
est, se, stat, p = pooled["est"], pooled["se"], pooled["z"], pooled["p"]
ci_low, ci_high = pooled["ci_low"], pooled["ci_high"]
tau2 = 0.0
if pooling == "peto":
q, q_df, q_p = pooled["q"], pooled["q_df"], pooled["q_p"]
y, v = pooled["yi"], pooled["vi"]
else:
q, q_df, q_p = fe["qe"], fe["qe_df"], fe["qe_p"]
weights = (1 / v) / np.sum(1 / v) * 100
model_label = "Mantel–Haenszel common effect" if pooling == "mantel_haenszel" else "Peto common effect"
random_model = pooling == "inverse_variance" and model == "random"
if random_model:
t_lo, t_hi = meta.tau2_ci(y, v, level=conf)
i2, h2 = fit["i2"], fit["h2"]
i2_lo, i2_hi = meta.i2_from_tau2(t_lo, fit["s2"]), meta.i2_from_tau2(t_hi, fit["s2"])
pi_low, pi_high = meta.prediction_interval(est, se, tau2, k, level=conf, dist="t")
else:
t_lo = t_hi = i2_lo = i2_hi = float("nan")
i2 = max(0.0, (q - q_df) / q * 100) if q > 0 else 0.0 # Higgins & Thompson from Q
h2 = q / q_df if q_df > 0 else float("nan")
pi_low, pi_high = ci_low, ci_high
zc = float(stats.norm.ppf(1 - (1 - conf) / 2))
# %% Assumptions
assumptions = [
{"key": "k_studies", "label": "Enough studies", "status": "warn" if k < 10 and random_model else "pass",
"detail": f"{k} studies" + ("; τ² and the prediction interval are imprecise — consider Knapp–Hartung inference." if k < 10 and random_model else ".")},
{"key": "heterogeneity", "label": "Heterogeneity", "status": "warn" if q_p < 0.10 and not random_model else "info",
"detail": f"Q({q_df}) = {q:.2f}, {cs.fmt_p(q_p)}; I² = {i2:.1f}%" + ("; a common-effect model ignores this — consider random effects." if q_p < 0.10 and not random_model else ".")},
{"key": "independence", "label": "Independent estimates", "status": "info", "detail": "One estimate per study is assumed; several outcomes from one study need a multilevel model."},
]
# %% Result
lo_i, hi_i = y - zc * np.sqrt(v), y + zc * np.sqrt(v)
study_rows = [{"study": labels[i], "estimate": float(bt(y[i])), "low": float(bt(lo_i[i])), "high": float(bt(hi_i[i])), "weight": float(weights[i])} for i in range(k)]
summary_label = "Pooled (" + ("RE" if random_model else "CE") + ")"
forest = {
"label": cs.col("study", labels + [summary_label]),
"estimate": cs.col(DISPLAY_LABEL, [r["estimate"] for r in study_rows] + [float(bt(est))]),
"low": cs.col("low", [r["low"] for r in study_rows] + [float(bt(ci_low))]),
"high": cs.col("high", [r["high"] for r in study_rows] + [float(bt(ci_high))]),
"weight": cs.col("weight %", [r["weight"] for r in study_rows] + [100.0]),
"kind": cs.col("row", ["study"] * k + ["summary"]),
}
charts = [
cs.chart("forest", "forest-meta", "Studies and the pooled estimate", forest,
controls={"reference": 1 if RATIO else 0, "log": RATIO, **({"piLow": float(bt(pi_low)), "piHigh": float(bt(pi_high))} if random_model else {})}),
cs.chart("funnel", "meta-funnel", "Funnel plot", {"estimate": cs.col(MEASURE_LABEL, [float(t) for t in y]), "se": cs.col("standard error", [float(t) for t in np.sqrt(v)]),
"label": cs.col("study", labels)},
controls={"center": est, "contours": True}),
cs.chart("galbraith", "galbraith", "Radial (Galbraith) plot", {"z": cs.col("standardized estimate", [float(t) for t in y / np.sqrt(v)]),
"precision": cs.col("precision (1/SE)", [float(t) for t in 1 / np.sqrt(v)]), "label": cs.col("study", labels)},
controls={"slope": float(fe["beta"][0])}),
]
if design == "binary":
a, n1, c, n2 = (es[key][idx] for key in ("events_1", "total_1", "events_2", "total_2"))
charts.append(cs.chart("labbe", "labbe", "L'Abbé plot: event risk in each arm",
{"risk_1": cs.col("risk, group 1", [float(t) for t in a / n1]), "risk_2": cs.col("risk, group 2", [float(t) for t in c / n2]),
"weight": cs.col("participants", [float(t) for t in n1 + n2]), "label": cs.col("study", labels)}))
nan = lambda x: None if x is None or (isinstance(x, float) and math.isnan(x)) else x # noqa: E731
cs.publish({
"method": "meta.pool",
"methodVersion": "1.0.3",
"title": f"Meta-analysis of {k} studies ({model_label})",
"engine": cs.engine_info("numpy", "scipy"),
"n": k,
"summary": f"Pooled {DISPLAY_LABEL} {bt(est):.3g}, {conf:.0%} CI [{bt(ci_low):.3g}, {bt(ci_high):.3g}], {cs.fmt_p(p)}; Q({q_df}) = {q:.2f}, {cs.fmt_p(q_p)}, I² = {i2:.1f}%.",
"apa": f"{DISPLAY_LABEL} = {cs.fmt_num(float(bt(est)))}, {conf:.0%} CI [{cs.fmt_num(float(bt(ci_low)))}, {cs.fmt_num(float(bt(ci_high)))}], {cs.fmt_p(p)}; Q({q_df}) = {cs.fmt_num(q)}, {cs.fmt_p(q_p)}, I² = {i2:.1f}%",
"statistics": [
{"key": "est_bt", "label": "Pooled " + DISPLAY_LABEL, "value": float(bt(est))},
{"key": "p", "label": "p", "value": p, "format": "p"},
{"key": "q", "label": "Cochran's Q", "value": q}, {"key": "q_p", "label": "p (heterogeneity)", "value": q_p, "format": "p"},
{"key": "tau2", "label": "τ²", "value": tau2}, {"key": "i2", "label": "I² (%)", "value": i2},
],
"tables": [
{"key": "studies", "title": f"Studies ({DISPLAY_LABEL}, {conf:.0%} CI)",
"columns": [{"key": "study", "label": "Study", "type": "string"}, {"key": "estimate", "label": "Estimate", "type": "number"},
{"key": "low", "label": "CI low", "type": "number"}, {"key": "high", "label": "CI high", "type": "number"},
{"key": "weight", "label": "Weight %", "type": "number"}],
"rows": study_rows},
{"key": "heterogeneity", "title": "Heterogeneity",
"columns": [{"key": "quantity", "label": "", "type": "string"}, {"key": "value", "label": "Estimate", "type": "number"},
{"key": "low", "label": "CI low", "type": "number"}, {"key": "high", "label": "CI high", "type": "number"}],
"rows": [{"quantity": "τ²", "value": tau2, "low": nan(t_lo), "high": nan(t_hi)}, {"quantity": "τ", "value": math.sqrt(tau2), "low": nan(math.sqrt(t_lo) if t_lo == t_lo else t_lo), "high": nan(math.sqrt(t_hi) if t_hi == t_hi else t_hi)},
{"quantity": "I² (%)", "value": i2, "low": nan(i2_lo), "high": nan(i2_hi)}, {"quantity": "H²", "value": h2, "low": None, "high": None}]},
],
"effectSizes": [{"key": "est_bt", "label": "Pooled " + DISPLAY_LABEL, "value": float(bt(est)), "ciLow": float(bt(ci_low)), "ciHigh": float(bt(ci_high)), "ciLevel": conf,
"method": model_label}],
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"Prediction interval for a new study's true effect: [{bt(pi_low):.3g}, {bt(pi_high):.3g}]." if random_model else "Common-effect model: the interval describes these studies only."] + (["The z test ignores the uncertainty in τ²: with no effect it rejected 8.7% at the 5% level with 20 studies in simulation. Knapp–Hartung allows for it."] if random_model and fit["test"] != "knha" else []),
"charts": charts,
"values": {
"k": k, "k_left_out": len(left_out), "est": est, "se": se, "stat": stat, "p": p, "ci_low": ci_low, "ci_high": ci_high,
"est_bt": float(bt(est)), "ci_low_bt": float(bt(ci_low)), "ci_high_bt": float(bt(ci_high)),
"tau2": tau2, "tau": math.sqrt(tau2), "tau2_ci_low": t_lo, "tau2_ci_high": t_hi, "i2": i2, "i2_ci_low": i2_lo, "i2_ci_high": i2_hi, "h2": h2,
"q": q, "q_df": float(q_df), "q_p": q_p, "pi_low": pi_low, "pi_high": pi_high, "pi_low_bt": float(bt(pi_low)), "pi_high_bt": float(bt(pi_high)),
"measure": measure, "measure_label": MEASURE_LABEL, "effect_label": DISPLAY_LABEL, "model_label": model_label,
},
})
The exact script CodeSplash ran for example “Bcg rr reml” · R version 4.5.1 (2025-06-13)
# Meta-analysis (pool studies, heterogeneity)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.pool 1.0.3 · spec 6e902e32b28d2f2b
# Dataset: m1_bcg (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr) # cs_meta_* (twins of codesplash.stats.meta)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/m1_bcg.parquet", col_select = c("trial", "events_1", "total_1", "events_2", "total_2")))
n_input <- nrow(df)
df[["trial"]] <- factor(df[["trial"]], levels = c("Aronson 1948", "Ferguson & Simes 1949", "Rosenthal et al 1960", "Hart & Sutherland 1977", "Frimodt-Moller et al 1973", "Stein & Aronson 1953", "Vandiviere et al 1973", "TPT Madras 1980", "Coetzee & Berjak 1968", "Rosenthal et al 1961", "Comstock et al 1974", "Comstock & Webster 1969", "Comstock et al 1976")) # stored level order
df <- df[stats::complete.cases(df[c("trial", "events_1", "total_1", "events_2", "total_2")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("trial", "events_1", "total_1", "events_2", "total_2")) # infinite values stop the run (registry/errors.yaml)
# %% Studies
design <- "binary" # inferred from the bound columns
measure <- "RR"
cols <- list(
events_1 = as.numeric(df[["events_1"]]),
total_1 = as.numeric(df[["total_1"]]),
events_2 = as.numeric(df[["events_2"]]),
total_2 = as.numeric(df[["total_2"]]),
NULL
)
cols <- Filter(Negate(is.null), cols)
es <- cs_meta_escalc(design, measure, cols, zero_cells = "only0", drop00 = TRUE, ci_level = 0.95)
measure <- es$measure
labels_all <- as.character(df[["trial"]])
keep <- es$keep
left_out <- labels_all[!keep]
idx <- which(keep)
y <- es$yi[idx]; v <- es$vi[idx]
labels <- labels_all[idx]
k <- length(y)
if (k < 2) cs_error("CS_E_TOO_FEW_ROWS", what = "A meta-analysis", min = 2, n = k) # one usable study can't be pooled
if (length(left_out)) {
warnings <- c(warnings, paste0(sprintf("Left out (%d): ", length(left_out)), paste(left_out, collapse = ", "),
if (design == "binary") " — no events (or only events) in both arms." else " — effect or variance not computable."))
}
bt <- cs_meta_back(measure)
MEASURE_LABEL <- c(GEN = "effect", LOG = "log ratio", OR = "log odds ratio", RR = "log risk ratio", RD = "risk difference",
MD = "mean difference", SMD = "Hedges' g", ZCOR = "Fisher's z", COR = "correlation")[[measure]]
RATIO <- measure %in% c("OR", "RR", "LOG")
# What a back-transformed number is: a ratio, not a log ratio; a correlation, not Fisher's z.
DISPLAY_LABEL <- if (measure %in% c("OR", "RR", "LOG", "ZCOR")) c(OR = "odds ratio", RR = "risk ratio", LOG = "ratio", ZCOR = "correlation")[[measure]] else MEASURE_LABEL
# %% Pool
conf <- 0.95
model <- "random"
pooling <- "inverse_variance"
if (pooling != "inverse_variance" && design != "binary") stop("Mantel–Haenszel and Peto pooling need two-arm counts.")
if (pooling == "peto") { measure <- "OR"; MEASURE_LABEL <- "Peto log odds ratio"; DISPLAY_LABEL <- "Peto odds ratio"; RATIO <- TRUE; bt <- exp }
fe <- cs_meta_rma(y, v, method = "FE")
if (pooling == "inverse_variance") {
fit <- cs_meta_rma(y, v, method = if (model == "fixed") "FE" else "REML", test = "z",
knha_trunc = FALSE, level = conf)
est <- fit$beta[1]; se <- fit$se[1]; stat <- fit$stat[1]; p <- fit$pval[1]
ci_low <- fit$ci_low[1]; ci_high <- fit$ci_high[1]
tau2 <- fit$tau2; q <- fit$qe; q_df <- fit$qe_df; q_p <- fit$qe_p
weights <- fit$weights
model_label <- if (model == "fixed") "common-effect model" else paste0("random effects, τ² by ", fit$method, if (fit$test == "knha") ", Knapp–Hartung t" else "")
} else {
a <- es$events_1[idx]; n1 <- es$total_1[idx]; c <- es$events_2[idx]; n2 <- es$total_2[idx]
pooled <- if (pooling == "mantel_haenszel") cs_meta_mh(a, n1, c, n2, measure, level = conf) else cs_meta_peto(a, n1, c, n2, level = conf)
est <- pooled$est; se <- pooled$se; stat <- pooled$z; p <- pooled$p
ci_low <- pooled$ci_low; ci_high <- pooled$ci_high
tau2 <- 0
if (pooling == "peto") {
q <- pooled$q; q_df <- pooled$q_df; q_p <- pooled$q_p
y <- pooled$yi; v <- pooled$vi
} else {
q <- fe$qe; q_df <- fe$qe_df; q_p <- fe$qe_p
}
weights <- (1 / v) / sum(1 / v) * 100
model_label <- if (pooling == "mantel_haenszel") "Mantel–Haenszel common effect" else "Peto common effect"
}
random_model <- pooling == "inverse_variance" && model == "random"
if (random_model) {
tci <- cs_meta_tau2_ci(y, v, level = conf); t_lo <- tci[1]; t_hi <- tci[2]
i2 <- fit$i2; h2 <- fit$h2
i2_lo <- cs_meta_i2(t_lo, fit$s2); i2_hi <- cs_meta_i2(t_hi, fit$s2)
pint <- cs_meta_pi(est, se, tau2, k, level = conf, dist = "t"); pi_low <- pint[1]; pi_high <- pint[2]
} else {
t_lo <- t_hi <- i2_lo <- i2_hi <- NaN
i2 <- if (q > 0) max(0, (q - q_df) / q * 100) else 0
h2 <- if (q_df > 0) q / q_df else NaN
pi_low <- ci_low; pi_high <- ci_high
}
zc <- stats::qnorm(1 - (1 - conf) / 2)
# %% Assumptions
assumptions <- list(
list(key = "k_studies", label = "Enough studies", status = if (k < 10 && random_model) "warn" else "pass",
detail = paste0(sprintf("%d studies", k), if (k < 10 && random_model) "; τ² and the prediction interval are imprecise — consider Knapp–Hartung inference." else ".")),
list(key = "heterogeneity", label = "Heterogeneity", status = if (q_p < 0.10 && !random_model) "warn" else "info",
detail = paste0(sprintf("Q(%d) = %.2f, %s; I² = %.1f%%", as.integer(q_df), q, cs_fmt_p(q_p), i2),
if (q_p < 0.10 && !random_model) "; a common-effect model ignores this — consider random effects." else ".")),
list(key = "independence", label = "Independent estimates", status = "info", detail = "One estimate per study is assumed; several outcomes from one study need a multilevel model.")
)
# %% Result
lo_i <- y - zc * sqrt(v); hi_i <- y + zc * sqrt(v)
study_rows <- lapply(seq_len(k), function(i) list(study = labels[i], estimate = bt(y[i]), low = bt(lo_i[i]), high = bt(hi_i[i]), weight = weights[i]))
summary_label <- paste0("Pooled (", if (random_model) "RE" else "CE", ")")
disp <- DISPLAY_LABEL
forest <- list(
label = cs_col("study", c(labels, summary_label)),
estimate = cs_col(disp, c(bt(y), bt(est))),
low = cs_col("low", c(bt(lo_i), bt(ci_low))),
high = cs_col("high", c(bt(hi_i), bt(ci_high))),
weight = cs_col("weight %", c(weights, 100)),
kind = cs_col("row", c(rep("study", k), "summary"))
)
fcontrols <- list(reference = if (RATIO) 1 else 0, log = RATIO)
if (random_model) { fcontrols$piLow <- bt(pi_low); fcontrols$piHigh <- bt(pi_high) }
charts <- list(
cs_chart("forest", "forest-meta", "Studies and the pooled estimate", forest, controls = fcontrols),
cs_chart("funnel", "meta-funnel", "Funnel plot", list(estimate = cs_col(MEASURE_LABEL, y), se = cs_col("standard error", sqrt(v)), label = cs_col("study", labels)),
controls = list(center = est, contours = TRUE)),
cs_chart("galbraith", "galbraith", "Radial (Galbraith) plot", list(z = cs_col("standardized estimate", y / sqrt(v)), precision = cs_col("precision (1/SE)", 1 / sqrt(v)),
label = cs_col("study", labels)), controls = list(slope = fe$beta[1]))
)
if (design == "binary") {
a <- es$events_1[idx]; n1 <- es$total_1[idx]; c <- es$events_2[idx]; n2 <- es$total_2[idx]
charts[[length(charts) + 1]] <- cs_chart("labbe", "labbe", "L'Abbé plot: event risk in each arm",
list(risk_1 = cs_col("risk, group 1", a / n1), risk_2 = cs_col("risk, group 2", c / n2), weight = cs_col("participants", n1 + n2), label = cs_col("study", labels)))
}
pct <- sprintf("%.0f%%", conf * 100)
na_or <- function(x) if (is.na(x)) NULL else x
cs_publish(list(
method = "meta.pool",
methodVersion = "1.0.3",
title = sprintf("Meta-analysis of %d studies (%s)", k, model_label),
engine = cs_engine_info("stats", "nanoparquet"),
n = k,
summary = sprintf("Pooled %s %s, %s CI [%s, %s], %s; Q(%d) = %.2f, %s, I² = %.1f%%.", disp, format(signif(bt(est), 3)), pct,
format(signif(bt(ci_low), 3)), format(signif(bt(ci_high), 3)), cs_fmt_p(p), as.integer(q_df), q, cs_fmt_p(q_p), i2),
apa = sprintf("%s = %s, %s CI [%s, %s], %s; Q(%d) = %s, %s, I² = %.1f%%", disp, cs_fmt_num(bt(est)), pct, cs_fmt_num(bt(ci_low)), cs_fmt_num(bt(ci_high)),
cs_fmt_p(p), as.integer(q_df), cs_fmt_num(q), cs_fmt_p(q_p), i2),
statistics = list(
list(key = "est_bt", label = paste0("Pooled ", disp), value = bt(est)),
list(key = "p", label = "p", value = p, format = "p"),
list(key = "q", label = "Cochran's Q", value = q), list(key = "q_p", label = "p (heterogeneity)", value = q_p, format = "p"),
list(key = "tau2", label = "τ²", value = tau2), list(key = "i2", label = "I² (%)", value = i2)
),
tables = list(
list(key = "studies", title = sprintf("Studies (%s, %s CI)", disp, pct),
columns = list(list(key = "study", label = "Study", type = "string"), list(key = "estimate", label = "Estimate", type = "number"),
list(key = "low", label = "CI low", type = "number"), list(key = "high", label = "CI high", type = "number"),
list(key = "weight", label = "Weight %", type = "number")),
rows = study_rows),
list(key = "heterogeneity", title = "Heterogeneity",
columns = list(list(key = "quantity", label = "", type = "string"), list(key = "value", label = "Estimate", type = "number"),
list(key = "low", label = "CI low", type = "number"), list(key = "high", label = "CI high", type = "number")),
rows = list(list(quantity = "τ²", value = tau2, low = na_or(t_lo), high = na_or(t_hi)),
list(quantity = "τ", value = sqrt(tau2), low = na_or(sqrt(t_lo)), high = na_or(sqrt(t_hi))),
list(quantity = "I² (%)", value = i2, low = na_or(i2_lo), high = na_or(i2_hi)),
list(quantity = "H²", value = h2, low = NULL, high = NULL)))
),
effectSizes = list(list(key = "est_bt", label = paste0("Pooled ", disp), value = bt(est), ciLow = bt(ci_low), ciHigh = bt(ci_high), ciLevel = conf,
method = model_label)),
assumptions = assumptions,
warnings = warnings,
notes = c(list(if (random_model) sprintf("Prediction interval for a new study's true effect: [%s, %s].", format(signif(bt(pi_low), 3)), format(signif(bt(pi_high), 3)))
else "Common-effect model: the interval describes these studies only."),
if (random_model && fit$test != "knha") list("The z test ignores the uncertainty in τ²: with no effect it rejected 8.7% at the 5% level with 20 studies in simulation. Knapp–Hartung allows for it.")),
charts = charts,
values = list(
k = k, k_left_out = length(left_out), est = est, se = se, stat = stat, p = p, ci_low = ci_low, ci_high = ci_high,
est_bt = bt(est), ci_low_bt = bt(ci_low), ci_high_bt = bt(ci_high),
tau2 = tau2, tau = sqrt(tau2), tau2_ci_low = t_lo, tau2_ci_high = t_hi, i2 = i2, i2_ci_low = i2_lo, i2_ci_high = i2_hi, h2 = h2,
q = q, q_df = q_df, q_p = q_p, pi_low = pi_low, pi_high = pi_high, pi_low_bt = bt(pi_low), pi_high_bt = bt(pi_high),
measure = measure, measure_label = MEASURE_LABEL, effect_label = disp, model_label = model_label
)
))
Sources
- Cochran, W. G. (1954). The combination of estimates from different experiments. Biometrics, 10, 101–129.
- DerSimonian, R., & Laird, N. (1986). Meta-analysis in clinical trials. Controlled Clinical Trials, 7, 177–188.
- Viechtbauer, W. (2005). Bias and efficiency of meta-analytic variance estimators in the random-effects model. JEBS, 30, 261–293.
- Viechtbauer, W. (2007). Confidence intervals for the amount of heterogeneity in meta-analysis. Statistics in Medicine, 26, 37–52.
- Higgins, J. P. T., & Thompson, S. G. (2002). Quantifying heterogeneity in a meta-analysis. Statistics in Medicine, 21, 1539–1558.
- Higgins, J. P. T., Thompson, S. G., & Spiegelhalter, D. J. (2009). A re-evaluation of random-effects meta-analysis. JRSS A, 172, 137–159.
- Knapp, G., & Hartung, J. (2003). Improved tests for a random effects meta-regression with a single covariate. Statistics in Medicine, 22, 2693–2710.
- Paule, R. C., & Mandel, J. (1982). Consensus values and weighting factors. J. Res. NBS, 87, 377–385.
- Sidik, K., & Jonkman, J. N. (2005). Simple heterogeneity variance estimation for meta-analysis. JRSS C, 54, 367–384.
- Robins, J., Breslow, N., & Greenland, S. (1986). Biometrics, 42, 311–323; Sato, T., Greenland, S., & Robins, J. M. (1989). Biometrics, 45, 1323–1324.
- Yusuf, S., Peto, R., Lewis, J., Collins, R., & Sleight, P. (1985). Beta blockade during and after myocardial infarction. Progress in Cardiovascular Diseases, 27, 335–371.
- Hedges, L. V. (1981). Distribution theory for Glass's estimator of effect size. Journal of Educational Statistics, 6, 107–128.
From the CodeSplash method registry · meta.pool v1.0.3.