Skip to content

Does one study drive the result?

Use leave-one-out analysis, Baujat plots and cumulative meta-analysis to see whether the conclusion rests on a few studies.

Advanced ~11 min8 steps

What runs in CodeSplash

You will be able to

  • Run a leave-one-out analysis and report how far the estimate moves
  • Read a Baujat plot for contribution to heterogeneity and influence
  • Explain what a cumulative meta-analysis shows and what it can't

Read first

01

One study can carry a lot

Read

A pooled estimate is an average, and averages have leverage points. Before you trust one, remove each study in turn and pool again.

That is a leave-one-out analysis. For the BCG log risk ratios, the pooled value is −0.715. Removing any one trial keeps it between −0.795 and −0.628.

02

Which study matters most?

Predict

Predict first

Influence on a pooled estimate depends on what?

The largest trial, alwaysThe most extreme effect, alwaysIt depends on both weight and distance
Reveal

Both. An extreme result with almost no weight hardly moves the average, and neither does a heavy study sitting right on it. In these trials, the most influential is Hart & Sutherland 1977, with Cook's distance 0.23.

03

Read the panel

Read
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.
The exact R script · R 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
))
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.
The exact Python script · Python 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,
})
  • Studentized deleted residuals: is this study surprising, given the others? The largest absolute value here is 1.45, and 0 studies are flagged as outlying.
  • Cook's distance: how far does the whole fit move without it?
  • Baujat plot: contribution to heterogeneity on one axis, influence on the result on the other. The top-right corner is the one to investigate.
04

What would you do with an outlier?

Reflect

Say one trial dominates the Baujat plot. Removing it because it "looks wrong" is exactly the kind of choice that bends results.

Better: read that study's methods. Different population? Different dose? Then report the analysis with and without it, say why, and let the reader see both. What would you write in that paragraph?

05

Cumulative meta-analysis

Read

Add the studies one at a time, in order of year, and pool after each. You see when the answer stabilized.

For BCG, order is set by the year column in the Order role. A cumulative plot can show that further trials added little, or that early large effects shrank over time.

It is descriptive. Repeated looks at accumulating data inflate false positives if you treat each step as a test, so don't read a "first significant year" as a discovery date.

06

Check your understanding

Checkpoint

Check yourself

A leave-one-out analysis shows the pooled effect loses significance when one specific study is removed, while its size barely changes. What should you say?

Show the answer

Answer: b

Report size and interval rather than only crossing a threshold. A study's large weight can legitimately carry precision.

Check yourself

On a Baujat plot, which study should you look into first?

Show the answer

Answer: a

A study in the top-right corner both disagrees with the rest and changes the answer.

Check yourself

Read the influence panel for the BCG trials. What is the largest Cook's distance? Give two decimals.

Show the answer

Answer: 0.229481639115658

Cook's distance measures how far the whole fit moves without that study. It belongs to the most influential trial, which is worth reading in full before you decide anything.

07

Do it in CodeSplash

In the app

The Meta-analysis studio's Robustness step gathers leave-one-out, Baujat and cumulative views. The Multiverse tab there re-runs the analysis across reasonable choices of estimator and inclusion, so you see all the answers at once.

08

Recap

Recap
  • Leave-one-out shows how much rests on each study.
  • Influence combines weight and distance; the Baujat plot shows both.
  • Report analyses with and without influential studies, and read those studies' methods. Don't delete quietly.