Skip to content

BMeta-analysis · meta.influence

Influence and sensitivity of a meta-analysis

Does any single study drive the pooled result or the heterogeneity?

Leave-one-out re-analyses (pooled effect, τ², I² without each study), the Baujat plot (contribution to heterogeneity against influence on the result), studentized deleted residuals, Cook's distances and an optional cumulative meta-analysis in a chosen order.

Verified in Python and R Python and R agree to 10 decimals Also called leave-one-out, sensitivity analysis, Baujat plot…

A real result

Example “Bcg rr cumulative”, recorded in both engines. In the app, “Try this example” loads it into Analyze.

Influence diagnostics for 13 studiesRecorded · Python and R agreeRecorded 2026-11-17 · 103 values compared
R

Without one study at a time the pooled risk ratio ranges 0.452 to 0.533 (all studies 0.489); most influential: Hart & Sutherland 1977.

Largest Cook's distance
0.2295
Studies with |residual| > 1.96
0

Plots

Contribution to heterogeneity against influence on the resultWhich studies both create heterogeneity and pull the pooled result?
View data
studycontribution to Qinfluence on the pooled estimate
Aronson 19480.64720.0015
Ferguson & Simes 19496.8570.1121
Rosenthal et al 19602.0280.0243
Hart & Sutherland 197751.1070.2378
Frimodt-Moller et al 19730.88380.0670
Stein & Aronson 195318.3350.0003
Vandiviere et al 19736.3560.1079
TPT Madras 198049.3680.1990
Coetzee & Berjak 19680.02710.0184
Rosenthal et al 196112.1270.1114
Comstock et al 19740.66610.0490
Comstock & Webster 19691.4420.0618
Comstock et al 19762.3880.1153
Leave-one-out diagnosticsIs any study an outlier, and how much does the result change without it?
View data
Cook's distancerisk ratio without the studyhighstudylowstudentized residual
0.00170.49310.7155Aronson 19480.3398−0.2181
0.11320.51990.7409Ferguson & Simes 19490.3649−1.292
0.02600.50380.7250Rosenthal et al 19600.3501−0.7547
0.22950.53340.7541Hart & Sutherland 19770.3774−1.451
0.07620.46570.6782Frimodt-Moller et al 19730.31980.8477
0.00040.49120.7273Stein & Aronson 19530.3318−0.1180
0.10870.51930.7397Vandiviere et al 19730.3646−1.304
0.19920.45170.6426TPT Madras 19800.31751.450
0.02200.47650.7007Coetzee & Berjak 19680.32410.4076
0.11700.52050.7469Rosenthal et al 19610.3627−1.128
0.05810.46870.6879Comstock et al 19740.31930.6691
0.06340.46780.6684Comstock & Webster 19690.32741.290
0.12280.45950.6611Comstock et al 19760.31941.188
Cumulative meta-analysisWhen did the evidence become clear, and has it drifted as studies accumulated?
View data
risk ratiohighadded studylow
0.41091.257+ Aronson 19480.1343
0.26580.5268+ Ferguson & Simes 19490.1341
0.37830.6120+ Stein & Aronson 19530.2338
0.36750.5681+ Rosenthal et al 19600.2377
0.33240.4916+ Rosenthal et al 19610.2248
0.37780.5457+ Coetzee & Berjak 19680.2615
0.40610.5901+ Comstock & Webster 19690.2794
0.45450.6686+ Frimodt-Moller et al 19730.3089
0.42080.6182+ Vandiviere et al 19730.2864
0.45600.6491+ Comstock et al 19740.3204
0.49250.6987+ Comstock et al 19760.3472
0.45170.6426+ Hart & Sutherland 19770.3175
0.48940.6962+ TPT Madras 19800.3441

Assumptions

  • Independent estimates — One estimate per study is assumed.

Leave one out (risk ratio, 95% CI)

Left outPooledCI lowCI highτ²I² (%)Studentized residualCook's distance
Aronson 19480.49310.33980.71550.336293.226−0.21810.0017
Ferguson & Simes 19490.51990.36490.74090.292692.254−1.2920.1132
Rosenthal et al 19600.50380.35010.72500.320792.935−0.75470.0260
Hart & Sutherland 19770.53340.37740.75410.262890.412−1.4510.2295
Frimodt-Moller et al 19730.46570.31980.67820.327892.7630.84770.0762
Stein & Aronson 19530.49120.33180.72730.359690.912−0.11800.0004
Vandiviere et al 19730.51930.36460.73970.293092.278−1.3040.1087
TPT Madras 19800.45170.31750.64260.273287.0311.4500.1992
Coetzee & Berjak 19680.47650.32410.70070.349593.2130.40760.0220
Rosenthal et al 19610.52050.36270.74690.298792.232−1.1280.1170
Comstock et al 19740.46870.31930.68790.340591.8110.66910.0581
Comstock & Webster 19690.46780.32740.66840.308292.6781.2900.0634
Comstock et al 19760.45950.31940.66110.303792.3441.1880.1228

Cumulative pooled estimate

Study addedPooledCI lowCI high
+ Aronson 19480.41090.13431.257
+ Ferguson & Simes 19490.26580.13410.5268
+ Stein & Aronson 19530.37830.23380.6120
+ Rosenthal et al 19600.36750.23770.5681
+ Rosenthal et al 19610.33240.22480.4916
+ Coetzee & Berjak 19680.37780.26150.5457
+ Comstock & Webster 19690.40610.27940.5901
+ Frimodt-Moller et al 19730.45450.30890.6686
+ Vandiviere et al 19730.42080.28640.6182
+ Comstock et al 19740.45600.32040.6491
+ Comstock et al 19760.49250.34720.6987
+ Hart & Sutherland 19770.45170.31750.6426
+ TPT Madras 19800.48940.34410.6962
  • A study is worth a closer look when its studentized residual exceeds ±1.96 or its Cook's distance stands apart; never drop studies just to reduce heterogeneity.
Python

Without one study at a time the pooled risk ratio ranges 0.452 to 0.533 (all studies 0.489); most influential: Hart & Sutherland 1977.

Largest Cook's distance
0.2295
Studies with |residual| > 1.96
0

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • Independent estimates — One estimate per study is assumed.

Leave one out (risk ratio, 95% CI)

Left outPooledCI lowCI highτ²I² (%)Studentized residualCook's distance
Aronson 19480.49310.33980.71550.336293.226−0.21810.0017
Ferguson & Simes 19490.51990.36490.74090.292692.254−1.2920.1132
Rosenthal et al 19600.50380.35010.72500.320792.935−0.75470.0260
Hart & Sutherland 19770.53340.37740.75410.262890.412−1.4510.2295
Frimodt-Moller et al 19730.46570.31980.67820.327892.7630.84770.0762
Stein & Aronson 19530.49120.33180.72730.359690.912−0.11800.0004
Vandiviere et al 19730.51930.36460.73970.293092.278−1.3040.1087
TPT Madras 19800.45170.31750.64260.273287.0311.4500.1992
Coetzee & Berjak 19680.47650.32410.70070.349593.2130.40760.0220
Rosenthal et al 19610.52050.36270.74690.298792.232−1.1280.1170
Comstock et al 19740.46870.31930.68790.340591.8110.66910.0581
Comstock & Webster 19690.46780.32740.66840.308292.6781.2900.0634
Comstock et al 19760.45950.31940.66110.303792.3441.1880.1228

Cumulative pooled estimate

Study addedPooledCI lowCI high
+ Aronson 19480.41090.13431.257
+ Ferguson & Simes 19490.26580.13410.5268
+ Stein & Aronson 19530.37830.23380.6120
+ Rosenthal et al 19600.36750.23770.5681
+ Rosenthal et al 19610.33240.22480.4916
+ Coetzee & Berjak 19680.37780.26150.5457
+ Comstock & Webster 19690.40610.27940.5901
+ Frimodt-Moller et al 19730.45450.30890.6686
+ Vandiviere et al 19730.42080.28640.6182
+ Comstock et al 19740.45600.32040.6491
+ Comstock et al 19760.49250.34720.6987
+ Hart & Sutherland 19770.45170.31750.6426
+ TPT Madras 19800.48940.34410.6962
  • A study is worth a closer look when its studentized residual exceeds ±1.96 or its Cook's distance stands apart; never drop studies just to reduce heterogeneity.

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 cumulativem1_bcg · events_1: events_1 · events_2: events_2 · order: year · study: trial · total_1: total_1 · total_2: total_2
  • Raudenbush knham1_raudenbush · effect: effect · se: se · study: study
  • Molloy dlm1_molloy · n: n · r: r · study: study
  • Degenerate n2m1_bcg · events_1: events_1 · events_2: events_2 · order: year · study: trial · total_1: total_1 · total_2: total_2

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.
Order for cumulative analysis (optional)numeric / temporal · 0–1 column
Adds studies in this order (usually publication year) to show how the evidence accumulated.

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 the Wald one.

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.

  • Independent estimates

    One estimate per study; several outcomes or arms from one study need a multilevel model.

What it reports

k
How many groups, studies or clusters the analysis used. Many methods are less reliable when k is small.
est
The average effect across studies from a meta-analysis, weighted by each study's precision.
tau2
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.
n_outlying
How many independent units the analysis used; it sets precision and power.
max_abs_rstudent
Refits the meta-analysis without each study in turn, to show whether one study drives the result.
max_cooks
How much all fitted values change when one observation is removed; large values mark influential points.
most_influential
Refits the meta-analysis without each study in turn, to show whether one study drives the result.
loo_min
Refits the meta-analysis without each study in turn, to show whether one study drives the result.
loo_max
Refits the meta-analysis without each study in turn, to show whether one study drives the result.
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.

Per group, level or term: loo_est[<study>], loo_tau2[<study>], rstudent[<study>], cooks[<study>], baujat_x[<study>], baujat_y[<study>], cum_est[<study>]

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

  • Every leave-one-out and cumulative fit is the codesplash mixed-effects twin, so the engines agree to ~1e-10.
Python

The exact script CodeSplash ran for example “Bcg rr cumulative” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0

# Influence and sensitivity of a meta-analysis
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.influence 1.0.1 · spec 6fb09b86419432d8
# 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 numpy as np
import pandas as pd

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", "year"])
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", "year"])  # 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", "year"])  # 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)
if k < 3:
    cs.cs_error("CS_E_TOO_FEW_ROWS", what="Leave-one-out influence", min=3, n=k)  # each refit leaves out one study and needs two

# %% Influence
conf = 0.95
fit_method = "FE" if "random" == "fixed" else "REML"
test = "z"
inf = meta.influence(y, v, method=fit_method, test=test, level=conf)
full, rows = inf["full"], inf["rows"]
est = float(full["beta"][0])
rstud = np.array([r["rstudent"] for r in rows])
cooks = np.array([r["cooks"] for r in rows])
loo = np.array([r["est"] for r in rows])
top = int(np.argmax(cooks))
order = np.argsort(df["year"].to_numpy()[idx], kind="stable")  # cumulative order: year
cum = meta.cumulative(y, v, order, method=fit_method, test=test, level=conf)

# %% Assumptions
assumptions = [{"key": "independence", "label": "Independent estimates", "status": "info", "detail": "One estimate per study is assumed."}]

# %% Result
disp = MEASURE_LABEL.replace("log ", "") if RATIO else MEASURE_LABEL
values = {"k": k, "est": est, "tau2": full["tau2"], "i2": full["i2"], "n_outlying": int(np.sum(np.abs(rstud) > 1.96)),
          "max_abs_rstudent": float(np.max(np.abs(rstud))), "max_cooks": float(cooks[top]), "most_influential": labels[top],
          "loo_min": float(loo.min()), "loo_max": float(loo.max()), "measure": measure, "measure_label": MEASURE_LABEL}
for i, r in enumerate(rows):
    values[f"loo_est[{labels[i]}]"] = r["est"]; values[f"loo_tau2[{labels[i]}]"] = r["tau2"]; values[f"rstudent[{labels[i]}]"] = r["rstudent"]
    values[f"cooks[{labels[i]}]"] = r["cooks"]; values[f"baujat_x[{labels[i]}]"] = r["baujat_x"]; values[f"baujat_y[{labels[i]}]"] = r["baujat_y"]
table_rows = [{"study": labels[i], "loo": float(bt(r["est"])), "low": float(bt(r["ci_low"])), "high": float(bt(r["ci_high"])), "tau2": r["tau2"], "i2": r["i2"],
               "rstudent": r["rstudent"], "cooks": r["cooks"]} for i, r in enumerate(rows)]
charts = [
    cs.chart("baujat", "baujat", "Contribution to heterogeneity against influence on the result",
             {"x": cs.col("contribution to Q", [r["baujat_x"] for r in rows]), "y": cs.col("influence on the pooled estimate", [r["baujat_y"] for r in rows]),
              "label": cs.col("study", labels)}),
    cs.chart("influence", "influence-panel", "Leave-one-out diagnostics",
             {"label": cs.col("study", labels), "rstudent": cs.col("studentized residual", [float(t) for t in rstud]), "cooks": cs.col("Cook's distance", [float(t) for t in cooks]),
              "estimate": cs.col(disp + " without the study", [t["loo"] for t in table_rows]), "low": cs.col("low", [t["low"] for t in table_rows]),
              "high": cs.col("high", [t["high"] for t in table_rows])},
             controls={"pooled": float(bt(est)), "log": RATIO}),
]
cum_rows = []
if cum is not None:
    for j, c in enumerate(cum):
        values[f"cum_est[{labels[order[j]]}]"] = c["est"]
        cum_rows.append({"study": "+ " + labels[order[j]], "estimate": float(bt(c["est"])), "low": float(bt(c["ci_low"])), "high": float(bt(c["ci_high"]))})
    charts.append(cs.chart("cumulative", "cumulative-forest", "Cumulative meta-analysis",
                           {"label": cs.col("added study", [r["study"] for r in cum_rows]), "estimate": cs.col(disp, [r["estimate"] for r in cum_rows]),
                            "low": cs.col("low", [r["low"] for r in cum_rows]), "high": cs.col("high", [r["high"] for r in cum_rows])},
                           controls={"reference": 1 if RATIO else 0, "log": RATIO}))
cs.publish({
    "method": "meta.influence",
    "methodVersion": "1.0.1",
    "title": f"Influence diagnostics for {k} studies",
    "engine": cs.engine_info("numpy", "scipy"),
    "n": k,
    "summary": f"Without one study at a time the pooled {disp} ranges {bt(loo.min()):.3g} to {bt(loo.max()):.3g} (all studies {bt(est):.3g}); most influential: {labels[top]}.",
    "statistics": [{"key": "max_cooks", "label": "Largest Cook's distance", "value": float(cooks[top])},
                   {"key": "n_outlying", "label": "Studies with |residual| > 1.96", "value": int(np.sum(np.abs(rstud) > 1.96)), "format": "integer"}],
    "tables": [{"key": "loo", "title": f"Leave one out ({disp}, {conf:.0%} CI)",
                "columns": [{"key": "study", "label": "Left out", "type": "string"}, {"key": "loo", "label": "Pooled", "type": "number"},
                            {"key": "low", "label": "CI low", "type": "number"}, {"key": "high", "label": "CI high", "type": "number"},
                            {"key": "tau2", "label": "τ²", "type": "number"}, {"key": "i2", "label": "I² (%)", "type": "number"},
                            {"key": "rstudent", "label": "Studentized residual", "type": "number"}, {"key": "cooks", "label": "Cook's distance", "type": "number"}],
                "rows": table_rows}]
              + ([{"key": "cumulative", "title": "Cumulative pooled estimate", "columns": [{"key": "study", "label": "Study added", "type": "string"},
                   {"key": "estimate", "label": "Pooled", "type": "number"}, {"key": "low", "label": "CI low", "type": "number"}, {"key": "high", "label": "CI high", "type": "number"}],
                  "rows": cum_rows}] if cum_rows else []),
    "assumptions": assumptions,
    "warnings": warnings,
    "notes": ["A study is worth a closer look when its studentized residual exceeds ±1.96 or its Cook's distance stands apart; never drop studies just to reduce heterogeneity."],
    "charts": charts,
    "values": values,
})
R

The exact script CodeSplash ran for example “Bcg rr cumulative” · R version 4.5.1 (2025-06-13)

# Influence and sensitivity of a meta-analysis
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.influence 1.0.1 · spec 6fb09b86419432d8
# 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", "year")))
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", "year")]), , 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", "year"))  # 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
if (k < 3) cs_error("CS_E_TOO_FEW_ROWS", what = "Leave-one-out influence", min = 3, n = k)  # each refit leaves out one study and needs two

# %% Influence
conf <- 0.95
fit_method <- if ("random" == "fixed") "FE" else "REML"
test <- "z"
inf <- cs_meta_influence(y, v, method = fit_method, test = test, level = conf)
full <- inf$full; rows <- inf$rows
est <- full$beta[1]
rstud <- vapply(rows, function(r) r$rstudent, numeric(1))
cooks <- vapply(rows, function(r) r$cooks, numeric(1))
loo <- vapply(rows, function(r) r$est, numeric(1))
top <- which.max(cooks)
ord <- order(df[["year"]][idx], method = "radix")  # cumulative order: year
cum <- cs_meta_cumulative(y, v, ord, method = fit_method, test = test, level = conf)

# %% Assumptions
assumptions <- list(list(key = "independence", label = "Independent estimates", status = "info", detail = "One estimate per study is assumed."))

# %% Result
disp <- if (RATIO) sub("log ", "", MEASURE_LABEL) else MEASURE_LABEL
values <- list(k = k, est = est, tau2 = full$tau2, i2 = full$i2, n_outlying = sum(abs(rstud) > 1.96), max_abs_rstudent = max(abs(rstud)),
               max_cooks = cooks[top], most_influential = labels[top], loo_min = min(loo), loo_max = max(loo), measure = measure, measure_label = MEASURE_LABEL)
for (i in seq_along(rows)) {
  r <- rows[[i]]; l <- labels[i]
  values[[sprintf("loo_est[%s]", l)]] <- r$est; values[[sprintf("loo_tau2[%s]", l)]] <- r$tau2; values[[sprintf("rstudent[%s]", l)]] <- r$rstudent
  values[[sprintf("cooks[%s]", l)]] <- r$cooks; values[[sprintf("baujat_x[%s]", l)]] <- r$baujat_x; values[[sprintf("baujat_y[%s]", l)]] <- r$baujat_y
}
table_rows <- lapply(seq_along(rows), function(i) { r <- rows[[i]]
  list(study = labels[i], loo = bt(r$est), low = bt(r$ci_low), high = bt(r$ci_high), tau2 = r$tau2, i2 = r$i2, rstudent = r$rstudent, cooks = r$cooks) })
charts <- list(
  cs_chart("baujat", "baujat", "Contribution to heterogeneity against influence on the result",
           list(x = cs_col("contribution to Q", vapply(rows, function(r) r$baujat_x, numeric(1))),
                y = cs_col("influence on the pooled estimate", vapply(rows, function(r) r$baujat_y, numeric(1))), label = cs_col("study", labels))),
  cs_chart("influence", "influence-panel", "Leave-one-out diagnostics",
           list(label = cs_col("study", labels), rstudent = cs_col("studentized residual", rstud), cooks = cs_col("Cook's distance", cooks),
                estimate = cs_col(paste(disp, "without the study"), vapply(table_rows, function(t) t$loo, numeric(1))),
                low = cs_col("low", vapply(table_rows, function(t) t$low, numeric(1))), high = cs_col("high", vapply(table_rows, function(t) t$high, numeric(1)))),
           controls = list(pooled = bt(est), log = RATIO))
)
cum_rows <- list()
if (!is.null(cum)) {
  for (j in seq_along(cum)) {
    c <- cum[[j]]; l <- labels[ord[j]]
    values[[sprintf("cum_est[%s]", l)]] <- c$est
    cum_rows[[j]] <- list(study = paste("+", l), estimate = bt(c$est), low = bt(c$ci_low), high = bt(c$ci_high))
  }
  charts[[length(charts) + 1]] <- cs_chart("cumulative", "cumulative-forest", "Cumulative meta-analysis",
    list(label = cs_col("added study", vapply(cum_rows, function(r) r$study, character(1))), estimate = cs_col(disp, vapply(cum_rows, function(r) r$estimate, numeric(1))),
         low = cs_col("low", vapply(cum_rows, function(r) r$low, numeric(1))), high = cs_col("high", vapply(cum_rows, function(r) r$high, numeric(1)))),
    controls = list(reference = if (RATIO) 1 else 0, log = RATIO))
}
tables <- list(list(key = "loo", title = sprintf("Leave one out (%s, %.0f%% CI)", disp, conf * 100),
                    columns = list(list(key = "study", label = "Left out", type = "string"), list(key = "loo", label = "Pooled", type = "number"),
                                   list(key = "low", label = "CI low", type = "number"), list(key = "high", label = "CI high", type = "number"),
                                   list(key = "tau2", label = "τ²", type = "number"), list(key = "i2", label = "I² (%)", type = "number"),
                                   list(key = "rstudent", label = "Studentized residual", type = "number"), list(key = "cooks", label = "Cook's distance", type = "number")),
                    rows = table_rows))
if (length(cum_rows)) tables[[2]] <- list(key = "cumulative", title = "Cumulative pooled estimate",
  columns = list(list(key = "study", label = "Study added", type = "string"), list(key = "estimate", label = "Pooled", type = "number"),
                 list(key = "low", label = "CI low", type = "number"), list(key = "high", label = "CI high", type = "number")), rows = cum_rows)
cs_publish(list(
  method = "meta.influence",
  methodVersion = "1.0.1",
  title = sprintf("Influence diagnostics for %d studies", k),
  engine = cs_engine_info("stats", "nanoparquet"),
  n = k,
  summary = sprintf("Without one study at a time the pooled %s ranges %s to %s (all studies %s); most influential: %s.", disp, format(signif(bt(min(loo)), 3)),
                    format(signif(bt(max(loo)), 3)), format(signif(bt(est), 3)), labels[top]),
  statistics = list(list(key = "max_cooks", label = "Largest Cook's distance", value = cooks[top]),
                    list(key = "n_outlying", label = "Studies with |residual| > 1.96", value = sum(abs(rstud) > 1.96), format = "integer")),
  tables = tables,
  assumptions = assumptions,
  warnings = warnings,
  notes = list("A study is worth a closer look when its studentized residual exceeds ±1.96 or its Cook's distance stands apart; never drop studies just to reduce heterogeneity."),
  charts = charts,
  values = values
))

Sources

  • Viechtbauer, W., & Cheung, M. W.-L. (2010). Outlier and influence diagnostics for meta-analysis. Research Synthesis Methods, 1, 112–125.
  • Baujat, B., Mahé, C., Pignon, J.-P., & Hill, C. (2002). A graphical method for exploring heterogeneity in meta-analyses. Statistics in Medicine, 21, 2641–2652.
  • Lau, J., et al. (1992). Cumulative meta-analysis of therapeutic trials for myocardial infarction. NEJM, 327, 248–254.

From the CodeSplash method registry · meta.influence v1.0.1.