The results nobody sees
When only significant results get shown, the ones you see overstate the truth, even if every study was run honestly. See it in a literature, in a single estimate and in your own team.
What runs in CodeSplash
- Small-study effects and publication bias Verified in Python and R
You will be able to
- Explain how selective reporting biases a body of evidence
- Explain why significant estimates from small studies overstate the effect
- Use bias methods as sensitivity analyses, not corrections
- Report what you tried and didn't show
Read first
A clean literature
PredictPredict first
Sixty teams study the same small effect, all competently. Only the significant results get written up. What does the average published effect look like?
Reveal
It overstates the truth. A small study can only reach significance with a large estimate, so the filter keeps the lucky ones. Nobody did anything wrong in any single study.
Hide the studies
ExploreRaise the share of non-significant studies that go missing, and watch the funnel lose a corner and the pooled estimate drift. Then set the true effect to zero, and hide most of the non-significant ones.
BExplorable · The funnel and publication bias
What does a literature look like when non-significant studies go missing?
What effect does the published literature estimate?
Dashed: the 95% funnel around the truth. Colored: published. Faded: hidden. The bold line is the estimate you would read in the literature.
Commit your prediction above to see the result
Make your prediction to see the result.
With a true effect of zero, the remaining studies still look like evidence. That's publication biasPublication biasA distortion of the visible evidence, because whether a result is shown depends on what it found.. Non-significant results that stay in a drawer are the file drawerFile drawerThe results nobody sees, because they weren't significant or weren't what anyone hoped for..
The winner's curse
ExploreThe same filter works on one estimate. Keep the true effect fixed, and compare the average of all estimates with the average of the significant ones. Then raise .
BExplorable · The winner's curse
Why do significant results from small studies overstate the effect?
Among the significant studies, how many times larger than the truth is the average reported effect?
Commit your prediction above to see the result
Make your prediction to see the result.
A small study can only clear the bar by overestimating. That's the winner's curseWinner's curseSignificant estimates from small studies overstate the effect, because only large estimates clear the bar., and it's why replications so often find less. Getting significance from a small sample isn't a sign of a strong effect. It's a reason to expect a smaller one next time.
import numpy as np
from scipy import stats
rng = np.random.default_rng(1)
true_d, n, reps = 0.3, 20, 10_000
kept = []
for _ in range(reps):
a, b = rng.normal(true_d, 1, n), rng.normal(0, 1, n)
if stats.ttest_ind(a, b).pvalue <= 0.05:
kept.append(a.mean() - b.mean())
print(true_d, np.mean(kept), len(kept) / reps) # truth, average winner, powerset.seed(1)
true_d <- 0.3; n <- 20
res <- replicate(10000, {
a <- rnorm(n, true_d); b <- rnorm(n)
c(diff = mean(a) - mean(b), p = t.test(a, b, var.equal = TRUE)$p.value)
})
winners <- res["diff", res["p", ] <= 0.05]
c(truth = true_d, average_winner = mean(winners), power = length(winners) / 10000)It happens at your desk
ReflectYou don't need journals for this. Which A/B tests get a slide at the quarterly review? Which analyses go in the report, and which stay in the notebook? Inside one study, the outcome that "worked" gets the headline, and the others get a footnote.
Think about the last result you presented. How many analyses sit behind it that nobody else knows about? Would your reader's confidence change if they knew?
How far could it move?
ReadMethods for small-study effects ask how an estimate might change. Among studies of passive smoking and lung cancer, the pooled log ratio is 0.219 from 37 studies. Trim-and-fill gives 0.174, and PET-PEESE gives 0.00504.
Those are sensitivity analyses, and they disagree here because they assume different things. They aren't a corrected answer. Asymmetry can have other causes too. The Small-study effects lesson in the Specialized track covers them in depth.
Egger's test p = .023; Begg's τ = 0.14, p = .216; trim-and-fill k₀ = 7
- p (Egger)
- .023
- p (Begg)
- .216
- Studies imputed
- 7
Plots
View data
| log ratio | study | study | standard error |
|---|---|---|---|
| 0.1655 | observed | Garfinkel 1981 | 0.1370 |
| 0.3716 | observed | Hirayama 1984 | 0.1818 |
| 0.7031 | observed | Butler 1988 | 0.7350 |
| 0.1823 | observed | Cardenas 1997 | 0.1768 |
| −0.2877 | observed | Chan 1982 | 0.2822 |
| 0.7275 | observed | Correa 1983 | 0.4768 |
| 0.7561 | observed | Trichopolous 1983 | 0.2982 |
| −0.2231 | observed | Buffler 1984 | 0.4390 |
| −0.2357 | observed | Kabat 1984 | 0.5823 |
| 0.6981 | observed | Lam 1985 | 0.3132 |
| 0.2070 | observed | Garfinkel 1985 | 0.2134 |
| 0.1823 | observed | Wu 1985 | 0.4814 |
| 0.4187 | observed | Akiba 1986 | 0.2822 |
| 0.0296 | observed | Lee 1986 | 0.4663 |
| 0.4383 | observed | Koo 1987 | 0.2774 |
| 0.0296 | observed | Pershagen 1987 | 0.2674 |
| 0.8502 | observed | Humble 1987 | 0.5409 |
| 0.5008 | observed | Lam 1987 | 0.1801 |
| 0.1740 | observed | Gao 1987 | 0.1905 |
| 0.4187 | observed | Brownson 1987 | 0.6956 |
| 0.7701 | observed | Geng 1988 | 0.3519 |
| 0.0770 | observed | Shimizu 1988 | 0.2666 |
| 0.9361 | observed | Inoue 1988 | 0.6310 |
| 0.4824 | observed | Kalandidi 1990 | 0.2994 |
| 0.0583 | observed | Sobue 1990 | 0.1836 |
| −0.2357 | observed | Wu-Williams 1990 | 0.1270 |
| −0.3011 | observed | Liu 1991 | 0.4245 |
| 0.8198 | observed | Jockel 1991 | 0.5632 |
| −0.0305 | observed | Brownson 1992 | 0.1120 |
| 0.4700 | observed | Stockwell 1992 | 0.3372 |
| 0.1740 | observed | Du 1993 | 0.2989 |
| 0.5068 | observed | Liu 1993 | 0.4195 |
| 0.2311 | observed | Fontham 1994 | 0.1001 |
| 0.0953 | observed | Kabat 1995 | 0.2936 |
| 0.5068 | observed | Zaridze 1995 | 0.1997 |
| 0.1484 | observed | Sun 1996 | 0.1908 |
| 0.1044 | observed | Wang 1996 | 0.2577 |
| −0.3601 | imputed | imputed 1 | 0.7350 |
| −0.3845 | imputed | imputed 2 | 0.4768 |
| −0.4131 | imputed | imputed 3 | 0.2982 |
| −0.4271 | imputed | imputed 4 | 0.3519 |
| −0.4768 | imputed | imputed 5 | 0.5632 |
| −0.5072 | imputed | imputed 6 | 0.5409 |
| −0.5931 | imputed | imputed 7 | 0.6310 |
Assumptions
- Enough studies — 37 studies.
- Low heterogeneity — I² = 29.6%.
Small-study diagnostics (ratio)
| Test | Statistic | p | |
|---|---|---|---|
| Egger (classic) | 2.382 | 0.0228 | limit effect 1.01 [0.844, 1.2] |
| Begg–Mazumdar | 0.1441 | 0.2157 | exact Kendall null |
| Trim-and-fill (R0) | 7 | — | 7 imputed on the left (smaller effects); adjusted 1.19 [1.08, 1.31] |
| PET-PEESE | 0.0050 | 0.9536 | PET estimate 1.01 [0.844, 1.2] |
| Fail-safe N (Rosenthal) | 392.71 | — | robust if above 5k + 10 = 195 |
- Asymmetry can come from publication bias, heterogeneity, chance or differences in study quality; these tests cannot tell which.
The exact R script · R R version 4.5.1 (2025-06-13)
# Small-study effects and publication bias
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.bias 1.0.1 · spec 8d1d4739f433156a
# Dataset: m1_hackshaw (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_hackshaw.parquet", col_select = c("study", "or", "or_low", "or_high")))
n_input <- nrow(df)
df[["study"]] <- factor(df[["study"]], levels = c("Garfinkel 1981", "Hirayama 1984", "Butler 1988", "Cardenas 1997", "Chan 1982", "Correa 1983", "Trichopolous 1983", "Buffler 1984", "Kabat 1984", "Lam 1985", "Garfinkel 1985", "Wu 1985", "Akiba 1986", "Lee 1986", "Koo 1987", "Pershagen 1987", "Humble 1987", "Lam 1987", "Gao 1987", "Brownson 1987", "Geng 1988", "Shimizu 1988", "Inoue 1988", "Kalandidi 1990", "Sobue 1990", "Wu-Williams 1990", "Liu 1991", "Jockel 1991", "Brownson 1992", "Stockwell 1992", "Du 1993", "Liu 1993", "Fontham 1994", "Kabat 1995", "Zaridze 1995", "Sun 1996", "Wang 1996")) # stored level order
df <- df[stats::complete.cases(df[c("study", "or", "or_low", "or_high")]), , 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("study", "or", "or_low", "or_high")) # infinite values stop the run (registry/errors.yaml)
# %% Studies
design <- "ratio_ci" # inferred from the bound columns
measure <- "GEN"
cols <- list(
effect = as.numeric(df[["or"]]),
ci_low = as.numeric(df[["or_low"]]),
ci_high = as.numeric(df[["or_high"]]),
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[["study"]])
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 = "Testing for small-study effects", min = 3, n = k) # Egger's regression and PET-PEESE fit two coefficients
if (all(y == y[1])) {
# Identical effects: Begg's rank correlation and the Egger / PET-PEESE regressions are undefined (an exact fit).
cs_error("CS_E_CONSTANT", column = "or")
}
# %% Small-study tests
conf <- 0.95
tau2_method <- "REML"
re <- cs_meta_rma(y, v, method = tau2_method, level = conf)
est <- re$beta[1]
eg <- cs_meta_egger(y, v, variant = "classic", method = tau2_method, level = conf)
bg <- cs_meta_begg(y, v)
tf <- cs_meta_trimfill(y, v, method = tau2_method, side = "auto", estimator = "R0")
pp <- cs_meta_pet_peese(y, v, alpha = 0.05, level = conf)
fs <- cs_meta_failsafe(y, v)
tff <- tf$filled
# %% Assumptions
assumptions <- list(
list(key = "k_studies", label = "Enough studies", status = if (k < 10) "warn" else "pass",
detail = paste0(sprintf("%d studies", k), if (k < 10) "; asymmetry tests have little power — a non-significant result says little." else ".")),
list(key = "heterogeneity", label = "Low heterogeneity", status = if (re$i2 > 50) "warn" else "pass",
detail = paste0(sprintf("I² = %.1f%%", re$i2), if (re$i2 > 50) "; heterogeneity alone can produce asymmetry and makes trim-and-fill unreliable." else "."))
)
# %% Result
disp <- if (RATIO) sub("log ", "", MEASURE_LABEL) else MEASURE_LABEL
side_word <- if (tf$side == "left") "left (smaller effects)" else "right (larger effects)"
g3 <- function(x) format(signif(x, 3))
rows <- list(
list(test = paste0("Egger", if (eg$variant == "classic") " (classic)" else " (meta-regression on SE)"), statistic = eg$stat, p = eg$p,
detail = sprintf("limit effect %s [%s, %s]", g3(bt(eg$limit)), g3(bt(eg$limit_ci_low)), g3(bt(eg$limit_ci_high)))),
list(test = "Begg–Mazumdar", statistic = bg$tau, p = bg$p, detail = if (bg$exact) "exact Kendall null" else "normal approximation"),
list(test = sprintf("Trim-and-fill (%s)", tf$estimator), statistic = tf$k0, p = NULL,
detail = sprintf("%d imputed on the %s; adjusted %s [%s, %s]", tf$k0, side_word, g3(bt(tff$beta[1])), g3(bt(tff$ci_low[1])), g3(bt(tff$ci_high[1])))),
list(test = "PET-PEESE", statistic = pp$est, p = pp$pet_p, detail = sprintf("%s estimate %s [%s, %s]", toupper(pp$use), g3(bt(pp$est)), g3(bt(pp$ci_low)), g3(bt(pp$ci_high)))),
list(test = "Fail-safe N (Rosenthal)", statistic = fs$fsn, p = NULL, detail = sprintf("robust if above 5k + 10 = %.0f", fs$threshold))
)
all_y <- c(y, tf$fill_y)
all_se <- sqrt(c(v, tf$fill_v))
cs_publish(list(
method = "meta.bias",
methodVersion = "1.0.1",
title = sprintf("Small-study effects in %d studies", k),
engine = cs_engine_info("stats", "nanoparquet"),
n = k,
summary = sprintf("Egger %s; Begg τ = %.3f, %s; trim-and-fill adds %d (pooled %s → %s).", cs_fmt_p(eg$p), bg$tau, cs_fmt_p(bg$p), tf$k0, g3(bt(est)), g3(bt(tff$beta[1]))),
apa = sprintf("Egger's test %s; Begg's τ = %s, %s; trim-and-fill k₀ = %d", cs_fmt_p(eg$p), cs_fmt_num(bg$tau), cs_fmt_p(bg$p), tf$k0),
statistics = list(list(key = "egger_p", label = "p (Egger)", value = eg$p, format = "p"), list(key = "begg_p", label = "p (Begg)", value = bg$p, format = "p"),
list(key = "tf_k0", label = "Studies imputed", value = tf$k0, format = "integer")),
tables = list(list(key = "tests", title = sprintf("Small-study diagnostics (%s)", disp),
columns = list(list(key = "test", label = "Test", type = "string"), list(key = "statistic", label = "Statistic", type = "number"),
list(key = "p", label = "p", type = "number"), list(key = "detail", label = "", type = "string")),
rows = rows)),
assumptions = assumptions,
warnings = warnings,
notes = list("Asymmetry can come from publication bias, heterogeneity, chance or differences in study quality; these tests cannot tell which."),
charts = list(cs_chart("funnel", "meta-funnel", "Funnel plot with imputed studies",
list(estimate = cs_col(MEASURE_LABEL, all_y), se = cs_col("standard error", all_se),
label = cs_col("study", c(labels, if (tf$k0 > 0) sprintf("imputed %d", seq_len(tf$k0)) else character(0))),
kind = cs_col("study", c(rep("observed", k), rep("imputed", tf$k0)))),
controls = list(center = est, adjusted = tff$beta[1], contours = TRUE, eggerIntercept = eg$limit, eggerSlope = eg$bias))),
values = list(
k = k, est = est, egger_stat = eg$stat, egger_p = eg$p, egger_bias = eg$bias, limit = eg$limit, limit_ci_low = eg$limit_ci_low,
limit_ci_high = eg$limit_ci_high, begg_tau = bg$tau, begg_p = bg$p, tf_k0 = tf$k0, tf_est = tff$beta[1], tf_ci_low = tff$ci_low[1],
tf_ci_high = tff$ci_high[1], pet = pp$pet, pet_p = pp$pet_p, peese = pp$peese, peese_p = pp$peese_p, pet_peese_est = pp$est, fsn = fs$fsn,
measure = measure, measure_label = MEASURE_LABEL, tf_side = side_word, pet_peese_use = pp$use
)
))
Egger's test p = .023; Begg's τ = 0.14, p = .216; trim-and-fill k₀ = 7
- p (Egger)
- .023
- p (Begg)
- .216
- Studies imputed
- 7
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Enough studies — 37 studies.
- Low heterogeneity — I² = 29.6%.
Small-study diagnostics (ratio)
| Test | Statistic | p | |
|---|---|---|---|
| Egger (classic) | 2.382 | 0.0228 | limit effect 1.01 [0.844, 1.2] |
| Begg–Mazumdar | 0.1441 | 0.2157 | exact Kendall null |
| Trim-and-fill (R0) | 7 | — | 7 imputed on the left (smaller effects); adjusted 1.19 [1.08, 1.31] |
| PET-PEESE | 0.0050 | 0.9536 | PET estimate 1.01 [0.844, 1.2] |
| Fail-safe N (Rosenthal) | 392.71 | — | robust if above 5k + 10 = 195 |
- Asymmetry can come from publication bias, heterogeneity, chance or differences in study quality; these tests cannot tell which.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Small-study effects and publication bias
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.bias 1.0.1 · spec 8d1d4739f433156a
# Dataset: m1_hackshaw (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_hackshaw.parquet", columns=["study", "or", "or_low", "or_high"])
n_input = len(df)
df["study"] = pd.Categorical(df["study"], categories=["Garfinkel 1981", "Hirayama 1984", "Butler 1988", "Cardenas 1997", "Chan 1982", "Correa 1983", "Trichopolous 1983", "Buffler 1984", "Kabat 1984", "Lam 1985", "Garfinkel 1985", "Wu 1985", "Akiba 1986", "Lee 1986", "Koo 1987", "Pershagen 1987", "Humble 1987", "Lam 1987", "Gao 1987", "Brownson 1987", "Geng 1988", "Shimizu 1988", "Inoue 1988", "Kalandidi 1990", "Sobue 1990", "Wu-Williams 1990", "Liu 1991", "Jockel 1991", "Brownson 1992", "Stockwell 1992", "Du 1993", "Liu 1993", "Fontham 1994", "Kabat 1995", "Zaridze 1995", "Sun 1996", "Wang 1996"]) # stored level order
df = df.dropna(subset=["study", "or", "or_low", "or_high"]) # listwise deletion over the analysis columns
df["study"] = df["study"].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, ["study", "or", "or_low", "or_high"]) # infinite values stop the run (registry/errors.yaml)
# %% Studies
design = "ratio_ci" # inferred from the bound columns
measure = "GEN"
cols = {
"effect": df["or"].to_numpy(dtype=float),
"ci_low": df["or_low"].to_numpy(dtype=float),
"ci_high": df["or_high"].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["study"].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="Testing for small-study effects", min=3, n=k) # Egger's regression and PET-PEESE fit two coefficients
if np.all(y == y[0]):
# Identical effects: Begg's rank correlation and the Egger / PET-PEESE regressions are undefined (an exact fit).
cs.cs_error("CS_E_CONSTANT", column="or")
# %% Small-study tests
conf = 0.95
tau2_method = "REML"
re = meta.rma(y, v, method=tau2_method, level=conf)
est = float(re["beta"][0])
eg = meta.egger(y, v, variant="classic", method=tau2_method, level=conf)
bg = meta.begg(y, v)
tf = meta.trimfill(y, v, method=tau2_method, side="auto", estimator="R0")
pp = meta.pet_peese(y, v, alpha=0.05, level=conf)
fs = meta.failsafe_n(y, v)
tff = tf["filled"]
# %% Assumptions
assumptions = [
{"key": "k_studies", "label": "Enough studies", "status": "warn" if k < 10 else "pass",
"detail": f"{k} studies" + ("; asymmetry tests have little power — a non-significant result says little." if k < 10 else ".")},
{"key": "heterogeneity", "label": "Low heterogeneity", "status": "warn" if re["i2"] > 50 else "pass",
"detail": f"I² = {re['i2']:.1f}%" + ("; heterogeneity alone can produce asymmetry and makes trim-and-fill unreliable." if re["i2"] > 50 else ".")},
]
# %% Result
disp = MEASURE_LABEL.replace("log ", "") if RATIO else MEASURE_LABEL
side_word = "left (smaller effects)" if tf["side"] == "left" else "right (larger effects)"
rows = [
{"test": "Egger" + (" (classic)" if eg["variant"] == "classic" else " (meta-regression on SE)"), "statistic": eg["stat"], "p": eg["p"],
"detail": f"limit effect {bt(eg['limit']):.3g} [{bt(eg['limit_ci_low']):.3g}, {bt(eg['limit_ci_high']):.3g}]"},
{"test": "Begg–Mazumdar", "statistic": bg["tau"], "p": bg["p"], "detail": "exact Kendall null" if bg["exact"] else "normal approximation"},
{"test": f"Trim-and-fill ({tf['estimator']})", "statistic": float(tf["k0"]), "p": None,
"detail": f"{tf['k0']} imputed on the {side_word}; adjusted {bt(float(tff['beta'][0])):.3g} [{bt(float(tff['ci_low'][0])):.3g}, {bt(float(tff['ci_high'][0])):.3g}]"},
{"test": "PET-PEESE", "statistic": pp["est"], "p": pp["pet_p"], "detail": f"{pp['use'].upper()} estimate {bt(pp['est']):.3g} [{bt(pp['ci_low']):.3g}, {bt(pp['ci_high']):.3g}]"},
{"test": "Fail-safe N (Rosenthal)", "statistic": fs["fsn"], "p": None, "detail": f"robust if above 5k + 10 = {fs['threshold']:.0f}"},
]
all_y = np.concatenate([y, tf["fill_y"]])
all_se = np.sqrt(np.concatenate([v, tf["fill_v"]]))
cs.publish({
"method": "meta.bias",
"methodVersion": "1.0.1",
"title": f"Small-study effects in {k} studies",
"engine": cs.engine_info("numpy", "scipy"),
"n": k,
"summary": f"Egger {cs.fmt_p(eg['p'])}; Begg τ = {bg['tau']:.3f}, {cs.fmt_p(bg['p'])}; trim-and-fill adds {tf['k0']} (pooled {bt(est):.3g} → {bt(float(tff['beta'][0])):.3g}).",
"apa": f"Egger's test {cs.fmt_p(eg['p'])}; Begg's τ = {cs.fmt_num(bg['tau'])}, {cs.fmt_p(bg['p'])}; trim-and-fill k₀ = {tf['k0']}",
"statistics": [{"key": "egger_p", "label": "p (Egger)", "value": eg["p"], "format": "p"}, {"key": "begg_p", "label": "p (Begg)", "value": bg["p"], "format": "p"},
{"key": "tf_k0", "label": "Studies imputed", "value": tf["k0"], "format": "integer"}],
"tables": [{"key": "tests", "title": f"Small-study diagnostics ({disp})",
"columns": [{"key": "test", "label": "Test", "type": "string"}, {"key": "statistic", "label": "Statistic", "type": "number"},
{"key": "p", "label": "p", "type": "number"}, {"key": "detail", "label": "", "type": "string"}],
"rows": rows}],
"assumptions": assumptions,
"warnings": warnings,
"notes": ["Asymmetry can come from publication bias, heterogeneity, chance or differences in study quality; these tests cannot tell which."],
"charts": [cs.chart("funnel", "meta-funnel", "Funnel plot with imputed studies",
{"estimate": cs.col(MEASURE_LABEL, [float(t) for t in all_y]), "se": cs.col("standard error", [float(t) for t in all_se]),
"label": cs.col("study", labels + [f"imputed {j + 1}" for j in range(tf["k0"])]),
"kind": cs.col("study", ["observed"] * k + ["imputed"] * tf["k0"])},
controls={"center": est, "adjusted": float(tff["beta"][0]), "contours": True, "eggerIntercept": eg["limit"], "eggerSlope": eg["bias"]})],
"values": {
"k": k, "est": est, "egger_stat": eg["stat"], "egger_p": eg["p"], "egger_bias": eg["bias"], "limit": eg["limit"], "limit_ci_low": eg["limit_ci_low"],
"limit_ci_high": eg["limit_ci_high"], "begg_tau": bg["tau"], "begg_p": bg["p"], "tf_k0": tf["k0"], "tf_est": float(tff["beta"][0]),
"tf_ci_low": float(tff["ci_low"][0]), "tf_ci_high": float(tff["ci_high"][0]), "pet": pp["pet"], "pet_p": pp["pet_p"], "peese": pp["peese"],
"peese_p": pp["peese_p"], "pet_peese_est": pp["est"], "fsn": fs["fsn"], "measure": measure, "measure_label": MEASURE_LABEL,
"tf_side": side_word, "pet_peese_use": pp["use"],
},
})
Check your understanding
CheckpointCheck yourself
A pilot with 20 people per group finds , . You're planning the main study. What should you assume about the effect?
Show the answer
Answer: c
A significant estimate from a small study is selected to be large. Plan for the effect that matters, not the one the pilot happened to report.
Check yourself
Every study in a set was run and analyzed correctly, with no p-hacking. Only the significant ones were published. Is the published set a fair picture of the evidence?
Show the answer
Answer: b
Bias here is a property of the set you're shown, not of any one study. More studies through the same filter give a more precise wrong answer.
Check yourself
Trim-and-fill moves a pooled estimate by a small amount. What can you say?
Show the answer
Answer: c
Treat each bias method as one "what if". Report several, and say what they assume.
Show the denominator
In the appThe simplest defense is a denominator: "We ran 14 tests, and 2 reached significance." Multiple testing in the Analyze rail keeps that count for each dataset, so you can quote it. For a set of studies, the Meta-analysis studio's Small-study effects step runs the sensitivity analyses above.
Recap
Recap- A filter on significance biases what you see, even when every study was done properly.
- Significant estimates from small studies overstate the effect, so plan for a smaller one.
- Report the denominator: everything you tried, not only what worked.
Concepts in this lesson