BMeta-analysis · meta.combine_p
Combine p-values (global test across studies)
Taken together, do several independent tests of the same question show an effect anywhere?
Combines k p-values into one test of the global null "every component null holds": Fisher, Stouffer (weighted, optionally for correlated tests), Tippett, Edgington, Lancaster, Wilkinson, Simes, Brown, the Cauchy combination (ACAT), higher criticism and Mudholkar–George. Choose the method before you look at the results; the other methods are shown as a sensitivity table, never as a menu to shop from.
A real result
Example “Fisher guide”, recorded in both engines. In the app, “Try this example” loads it into Analyze.
Fisher (−2 Σ log p) combination of k = 5 tests: 24.86, p = .006
- Combined statistic
- 24.858
- p (global null)
- .006
- Tests combined
- 5
Plots
View data
| test | p |
|---|---|
| Trial A | 0.0100 |
| Trial B | 0.0400 |
| Trial C | 0.2000 |
| Trial D | 0.5000 |
| Trial E | 0.1000 |
View data
| p |
|---|
| 0.0100 |
| 0.0400 |
| 0.2000 |
| 0.5000 |
| 0.1000 |
View data
| chosen | method | combined p |
|---|---|---|
| chosen | Fisher (−2 Σ log p) | 0.0056 |
| Stouffer Z (weighted) | 0.0028 | |
| Tippett (minimum p) | 0.0490 | |
| Edgington (sum of p) | 0.0037 | |
| Lancaster (weighted χ²) | 0.0079 | |
| Wilkinson (r-th smallest p) | 0.0490 | |
| Simes | 0.0500 | |
| Brown (dependent Fisher) | 0.0056 | |
| Cauchy combination (ACAT) | 0.0359 | |
| Higher criticism | 0.0017 | |
| Mudholkar–George (logit) | 0.0035 |
Assumptions
- Valid p-values — All 5 p-values lie in (0, 1].
- Independent tests — This method assumes the tests are independent; with correlated tests use Brown, Simes or Cauchy.
Component tests
| Test | p |
|---|---|
| Trial A | 0.0100 |
| Trial B | 0.0400 |
| Trial E | 0.1000 |
| Trial C | 0.2000 |
| Trial D | 0.5000 |
Every method on the same p-values (sensitivity; the chosen one counts)
| Method | Statistic | Reference | p | |
|---|---|---|---|---|
| Fisher (−2 Σ log p) | 24.858 | χ²(10) | 0.0056 | chosen |
| Stouffer Z (weighted) | 2.773 | N(0, 1) | 0.0028 | |
| Tippett (minimum p) | 0.0100 | Beta(1, 5) | 0.0490 | |
| Edgington (sum of p) | 0.8500 | Irwin–Hall(5) | 0.0037 | |
| Lancaster (weighted χ²) | 15.656 | χ²(5) | 0.0079 | |
| Wilkinson (r-th smallest p) | 0.0100 | Beta(1, 5) | 0.0490 | |
| Simes | 0.0500 | Simes | 0.0500 | |
| Brown (dependent Fisher) | 24.858 | 1·χ²(10) | 0.0056 | |
| Cauchy combination (ACAT) | 8.838 | standard Cauchy | 0.0359 | |
| Higher criticism | 3.354 | Monte Carlo, 10000 null draws | 0.0017 | |
| Mudholkar–George (logit) | 2.902 | t(29) | 0.0035 |
- The method was fixed before the results: the other rows are a sensitivity check, not alternatives to pick from.
Fisher (−2 Σ log p) combination of k = 5 tests: 24.86, p = .006
- Combined statistic
- 24.858
- p (global null)
- .006
- Tests combined
- 5
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Valid p-values — All 5 p-values lie in (0, 1].
- Independent tests — This method assumes the tests are independent; with correlated tests use Brown, Simes or Cauchy.
Component tests
| Test | p |
|---|---|
| Trial A | 0.0100 |
| Trial B | 0.0400 |
| Trial E | 0.1000 |
| Trial C | 0.2000 |
| Trial D | 0.5000 |
Every method on the same p-values (sensitivity; the chosen one counts)
| Method | Statistic | Reference | p | |
|---|---|---|---|---|
| Fisher (−2 Σ log p) | 24.858 | χ²(10) | 0.0056 | chosen |
| Stouffer Z (weighted) | 2.773 | N(0, 1) | 0.0028 | |
| Tippett (minimum p) | 0.0100 | Beta(1, 5) | 0.0490 | |
| Edgington (sum of p) | 0.8500 | Irwin–Hall(5) | 0.0037 | |
| Lancaster (weighted χ²) | 15.656 | χ²(5) | 0.0079 | |
| Wilkinson (r-th smallest p) | 0.0100 | Beta(1, 5) | 0.0490 | |
| Simes | 0.0500 | Simes | 0.0500 | |
| Brown (dependent Fisher) | 24.858 | 1·χ²(10) | 0.0056 | |
| Cauchy combination (ACAT) | 8.838 | standard Cauchy | 0.0359 | |
| Higher criticism | 3.354 | Monte Carlo, 10000 null draws | 0.0017 | |
| Mudholkar–George (logit) | 2.902 | t(29) | 0.0035 |
- The method was fixed before the results: the other rows are a sensitivity check, not alternatives to pick from.
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
- Fisher guidem1_pvalues · label: test · p: p
- Stouffer sqrt nm1_pvalues · label: test · p: p · weight: n
- Tippettm1_pvalues · p: p
- Edgingtonm1_pvalues · label: test · p: p
- Lancaster dfm1_pvalues · p: p · weight: n
- Wilkinson r2m1_pvalues · p: p
- Simesm1_sparse · label: test · p: p
- Brown rho 30m1_pvalues · label: test · p: p
In the guides
Tests from the statistics guide this method runs
What you need
- p-valuesnumeric · 1 column
- One p-value per test, each in (0, 1], all testing the same direction of the same question.
- Test labels (optional)categorical · 0–1 column
- Names the tests in tables and charts (study, outcome, site …).
- Weights or sample sizes (optional)numeric · 0–1 column
- Stouffer and Cauchy weights; Lancaster degrees of freedom. Sample sizes are typical (use √n with "Weight scale").
- Effect directions (optional)numeric · 0–1 column
- Stouffer only: each test's effect estimate (or +1/−1). Two-sided p-values become signed z, so opposite effects cancel.
Choices you make
hypothesis
- Combination methoddefault fisher
Decide before seeing the results; each method is most powerful against a different pattern of effects.
- Fisher(default) — Powerful when one or a few tests are very small; −2 Σ log p ~ χ²(2k).
- Stouffer Z — Balanced: rewards consistent moderate evidence; weights (√n) give larger studies more say.
- Lancaster — Fisher with per-test degrees of freedom from the weight column (2 = Fisher).
- Edgington — Sum of p-values (exact Irwin–Hall); favors many moderate p over one tiny one.
- Mudholkar–George — Sum of log odds of p, referred to t(5k + 4); a compromise between Fisher and Stouffer.
- Tippett — Smallest p: detects one strong effect; equivalent to a Šidák-adjusted minimum.
- Wilkinson — The r-th smallest p against Beta(r, k + 1 − r); r chosen in advance (r = 1 is Tippett).
- Simes — min k·p(i)/i: valid under positive dependence; the global test behind Benjamini–Hochberg.
- Higher criticism — Excess of small p-values when only a few tests carry weak signals; Monte Carlo null.
- Brown — Fisher with a scaled χ² matching the covariance of correlated tests (state ρ).
- Cauchy (ACAT) — Tan-transformed p: accurate under arbitrary dependence for small combined p.
- Order r (Wilkinson)default 1
Which smallest p-value to test; fix it before seeing the data.
- Correlation between tests (ρ)default 0
Common correlation of the underlying test statistics (Brown; Stouffer's denominator √wᵀRw).
- Component tests aredefault two
Brown's covariance depends on whether the p-values are one- or two-sided.
- Two-sided(default) — Your p-values come from two-sided tests; the usual case.
- One-sided — Your p-values come from one-sided tests in the same direction.
options
- Weight scaledefault sqrt
How the weight column becomes weights: square root (sample sizes) or as given.
- Square root (sample sizes)(default) — Takes the square root of the weights; right for sample sizes.
- As given — Uses the weights as given; pick it when they're already on the scale you want.
- Largest p used (α₀)default 0.5
Higher criticism scans p(i) between 1/k and α₀.
- Monte Carlo drawsdefault 10000
Null draws for the higher-criticism p-value (shared random stream: Python and R agree exactly).
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.
Valid p-values
Each p is uniform under its own null (no rounding to 'p < .05', no selective reporting).
Independent tests
Fisher, Stouffer (ρ = 0), Tippett, Edgington, Wilkinson and Mudholkar–George assume independence; use Brown, Simes or Cauchy otherwise.
Same directionNot checked from data: state why it holds
Combine one-sided p-values in the same direction, or two-sided ones for the same two-sided question.
What it reports
- Tests: Global null across the combined tests
- k
- How many groups, studies or clusters the analysis used. Many methods are less reliable when k is small.
- statistic
- One test of "every component null holds" from several independent tests' p-values.
- p
- One test of "every component null holds" from several independent tests' p-values.
- df
- How much independent information is left to estimate variability after fitting the model.
- method_label
- The exact variant that ran (for example Welch vs classic F), shown so the result can be reported and reproduced.
- min_p
- How surprising your data would be if the null hypothesis were true, as a probability.
- n_below_05
- How many independent units the analysis used; it sets precision and power.
- p_fisher
- One test of "every component null holds" from several independent tests' p-values.
- p_stouffer
- One test of "every component null holds" from several independent tests' p-values.
- p_tippett
- One test of "every component null holds" from several independent tests' p-values.
- p_edgington
- One test of "every component null holds" from several independent tests' p-values.
- p_lancaster
- One test of "every component null holds" from several independent tests' p-values.
- p_wilkinson
- One test of "every component null holds" from several independent tests' p-values.
- p_simes
- One test of "every component null holds" from several independent tests' p-values.
- p_brown
- One test of "every component null holds" from several independent tests' p-values.
- p_cauchy
- One test of "every component null holds" from several independent tests' p-values.
- p_hc
- One test of "every component null holds" from several independent tests' p-values.
- p_mudholkar_george
- One test of "every component null holds" from several independent tests' p-values.
Python and R
Python and R agree to 10 decimals (relative tolerance 1e-10). Python uses pandas, numpy, scipy, codesplash; R uses stats, nanoparquet, codesplashr.
Default traps between the two languages
- Every method is the codesplash twin in both engines (closed forms, the stable Irwin–Hall recursion, Monte Carlo on the shared Wichmann–Hill stream for higher criticism), so the engines agree to rounding. scipy.stats.combine_pvalues and metap/poolr are equivalent textbook calls; Brown here uses the Kost–McDermott (2002) covariance for a stated ρ rather than an empirical covariance.
The exact script CodeSplash ran for example “Fisher guide” · Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Combine p-values (global test across studies)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.combine_p 1.1.0 · spec cce5975d0878ff0d
# Dataset: m1_pvalues (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 # combination tests (twins of codesplashr::cs_meta_*)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/m1_pvalues.parquet", columns=["p", "test"])
n_input = len(df)
df["test"] = pd.Categorical(df["test"], categories=["Trial A", "Trial B", "Trial C", "Trial D", "Trial E"]) # stored level order
df = df.dropna(subset=["p", "test"]) # listwise deletion over the analysis columns
df["test"] = df["test"].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, ["p", "test"]) # infinite values stop the run (registry/errors.yaml)
# %% Combine
p = df["p"].to_numpy(dtype=float)
if len(p) < 2:
cs.cs_error("CS_E_TOO_FEW_ROWS", what="Combining p-values", min=2, n=len(p))
n_bad = int(np.sum((p <= 0) | (p > 1)))
if n_bad:
cs.cs_error("CS_E_INVALID_VALUES", column="p", requirement="a p-value in (0, 1]", count=n_bad)
labels = df["test"].astype(str).tolist()
weights = None
method = "fisher" # chosen before looking at the results
res = meta.combine_p(p, method, weights, r=1, rho=0, sides="two",
hc_alpha0=0.5, b=10000, seed=42)
chosen = res["chosen"]
k = len(p)
by = {r["method"]: r for r in res["all"]}
# %% Assumptions
assumptions = [
{"key": "valid", "label": "Valid p-values", "status": "pass" if np.all((p > 0) & (p <= 1)) else "fail",
"detail": f"All {k} p-values lie in (0, 1]." + (" Some equal 1: methods that need an open interval move them inside by 1e-12." if np.any(p == 1) else "")},
{"key": "independence", "label": "Independent tests", "status": "info",
"detail": ("Brown's scaled χ² accounts for the stated correlation." if method == "brown" else
"Valid under arbitrary dependence for small combined p." if method == "cauchy" else
"Valid under positive dependence." if method == "simes" else
"This method assumes the tests are independent; with correlated tests use Brown, Simes or Cauchy.")},
]
# %% Result
rows = [{"method": r["label"], "statistic": r["statistic"], "reference": r["reference"], "p": r["p"], "chosen": "chosen" if r["method"] == method else ""} for r in res["all"]]
order = np.argsort(p, kind="stable")
cs.publish({
"method": "meta.combine_p",
"methodVersion": "1.1.0",
"title": f"Combined test: {chosen['label']}",
"engine": cs.engine_info("numpy", "scipy"),
"n": k,
"summary": f"{chosen['label']} combination of {k} p-values: statistic {chosen['statistic']:.4g} against {chosen['reference']}, {cs.fmt_p(chosen['p'])}.",
"apa": f"{chosen['label']} combination of k = {k} tests: {cs.fmt_num(chosen['statistic'])}, {cs.fmt_p(chosen['p'])}",
"statistics": [
{"key": "statistic", "label": "Combined statistic", "value": chosen["statistic"]},
{"key": "p", "label": "p (global null)", "value": chosen["p"], "format": "p"},
{"key": "k", "label": "Tests combined", "value": k, "format": "integer"},
],
"tables": [
{"key": "components", "title": "Component tests", "columns": [{"key": "label", "label": "Test", "type": "string"}, {"key": "p", "label": "p", "type": "number"}],
"rows": [{"label": labels[i], "p": float(p[i])} for i in order]},
{"key": "methods", "title": "Every method on the same p-values (sensitivity; the chosen one counts)",
"columns": [{"key": "method", "label": "Method", "type": "string"}, {"key": "statistic", "label": "Statistic", "type": "number"},
{"key": "reference", "label": "Reference", "type": "string"}, {"key": "p", "label": "p", "type": "number"},
{"key": "chosen", "label": "", "type": "string"}],
"rows": rows},
],
"assumptions": assumptions,
"warnings": warnings,
"notes": ["The method was fixed before the results: the other rows are a sensitivity check, not alternatives to pick from."],
"charts": [
cs.chart("pvalue_qq", "pvalue-qq", "Observed p-values against the uniform null",
{"p": cs.col("p", [float(v) for v in p]), "label": cs.col("test", labels)}),
cs.chart("pvalue_hist", "pvalue-histogram", "Distribution of the component p-values",
{"p": cs.col("p", [float(v) for v in p])}, controls={"bins": 10}),
cs.chart("methods", "combine-compare", "Every method on the same p-values (sensitivity)",
{"method": cs.col("method", [r["method"] for r in rows]), "p": cs.col("combined p", [float(r["p"]) for r in rows]),
"chosen": cs.col("chosen", [r["chosen"] for r in rows])}),
],
"values": {
"k": k, "statistic": float(chosen["statistic"]), "p": float(chosen["p"]), "df": float(chosen["df"]),
"method_label": chosen["label"], "min_p": float(p.min()), "n_below_05": int(np.sum(p < 0.05)),
**{f"p_{m}": float(by[m]["p"]) for m in meta.COMBINE_METHODS},
},
})
The exact script CodeSplash ran for example “Fisher guide” · R version 4.5.1 (2025-06-13)
# Combine p-values (global test across studies)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method meta.combine_p 1.1.0 · spec cce5975d0878ff0d
# Dataset: m1_pvalues (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_combine_p (twin of codesplash.stats.meta)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/m1_pvalues.parquet", col_select = c("p", "test")))
n_input <- nrow(df)
df[["test"]] <- factor(df[["test"]], levels = c("Trial A", "Trial B", "Trial C", "Trial D", "Trial E")) # stored level order
df <- df[stats::complete.cases(df[c("p", "test")]), , 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("p", "test")) # infinite values stop the run (registry/errors.yaml)
# %% Combine
p <- as.numeric(df[["p"]])
if (length(p) < 2) cs_error("CS_E_TOO_FEW_ROWS", what = "Combining p-values", min = 2, n = length(p))
n_bad <- sum(p <= 0 | p > 1)
if (n_bad > 0) cs_error("CS_E_INVALID_VALUES", column = "p", requirement = "a p-value in (0, 1]", count = n_bad)
labels <- as.character(df[["test"]])
weights <- NULL
method <- "fisher" # chosen before looking at the results
res <- cs_meta_combine_p(p, method, weights, r = 1, rho = 0, sides = "two",
hc_alpha0 = 0.5, b = 10000, seed = 42)
chosen <- res$chosen
k <- length(p)
by <- setNames(res$all, cs_meta_combine_methods)
# %% Assumptions
assumptions <- list(
list(key = "valid", label = "Valid p-values", status = if (all(p > 0 & p <= 1)) "pass" else "fail",
detail = paste0(sprintf("All %d p-values lie in (0, 1].", k),
if (any(p == 1)) " Some equal 1: methods that need an open interval move them inside by 1e-12." else "")),
list(key = "independence", label = "Independent tests", status = "info",
detail = if (method == "brown") "Brown's scaled χ² accounts for the stated correlation."
else if (method == "cauchy") "Valid under arbitrary dependence for small combined p."
else if (method == "simes") "Valid under positive dependence."
else "This method assumes the tests are independent; with correlated tests use Brown, Simes or Cauchy.")
)
# %% Result
rows <- lapply(res$all, function(r) list(method = r$label, statistic = r$statistic, reference = r$reference, p = r$p,
chosen = if (r$method == method) "chosen" else ""))
ord <- order(p, method = "radix")
values <- list(k = k, statistic = chosen$statistic, p = chosen$p, df = chosen$df, method_label = chosen$label,
min_p = min(p), n_below_05 = sum(p < 0.05))
for (m in cs_meta_combine_methods) values[[paste0("p_", m)]] <- by[[m]]$p
cs_publish(list(
method = "meta.combine_p",
methodVersion = "1.1.0",
title = paste0("Combined test: ", chosen$label),
engine = cs_engine_info("stats", "nanoparquet"),
n = k,
summary = sprintf("%s combination of %d p-values: statistic %s against %s, %s.", chosen$label, k, format(signif(chosen$statistic, 4)),
chosen$reference, cs_fmt_p(chosen$p)),
apa = sprintf("%s combination of k = %d tests: %s, %s", chosen$label, k, cs_fmt_num(chosen$statistic), cs_fmt_p(chosen$p)),
statistics = list(
list(key = "statistic", label = "Combined statistic", value = chosen$statistic),
list(key = "p", label = "p (global null)", value = chosen$p, format = "p"),
list(key = "k", label = "Tests combined", value = k, format = "integer")
),
tables = list(
list(key = "components", title = "Component tests", columns = list(list(key = "label", label = "Test", type = "string"), list(key = "p", label = "p", type = "number")),
rows = lapply(ord, function(i) list(label = labels[i], p = p[i]))),
list(key = "methods", title = "Every method on the same p-values (sensitivity; the chosen one counts)",
columns = list(list(key = "method", label = "Method", type = "string"), list(key = "statistic", label = "Statistic", type = "number"),
list(key = "reference", label = "Reference", type = "string"), list(key = "p", label = "p", type = "number"),
list(key = "chosen", label = "", type = "string")),
rows = rows)
),
assumptions = assumptions,
warnings = warnings,
notes = list("The method was fixed before the results: the other rows are a sensitivity check, not alternatives to pick from."),
charts = list(
cs_chart("pvalue_qq", "pvalue-qq", "Observed p-values against the uniform null", list(p = cs_col("p", p), label = cs_col("test", labels))),
cs_chart("pvalue_hist", "pvalue-histogram", "Distribution of the component p-values", list(p = cs_col("p", p)), controls = list(bins = 10)),
cs_chart("methods", "combine-compare", "Every method on the same p-values (sensitivity)",
list(method = cs_col("method", vapply(rows, function(r) r$method, "")), p = cs_col("combined p", vapply(rows, function(r) r$p, 0)),
chosen = cs_col("chosen", vapply(rows, function(r) r$chosen, ""))))
),
values = values
))
Sources
- Fisher, R. A. (1932). Statistical Methods for Research Workers (4th ed.). Oliver & Boyd.
- Stouffer, S. A., et al. (1949). The American Soldier, Vol. 1. Princeton University Press.
- Tippett, L. H. C. (1931). The Methods of Statistics. Williams & Norgate.
- Edgington, E. S. (1972). An additive method for combining probability values from independent experiments. Journal of Psychology, 80, 351–363.
- Lancaster, H. O. (1961). The combination of probabilities: an application of orthonormal functions. Australian Journal of Statistics, 3, 20–33.
- Wilkinson, B. (1951). A statistical consideration in psychological research. Psychological Bulletin, 48, 156–158.
- Simes, R. J. (1986). An improved Bonferroni procedure for multiple tests of significance. Biometrika, 73, 751–754.
- Brown, M. B. (1975). A method for combining non-independent, one-sided tests of significance. Biometrics, 31, 987–992; Kost, J. T., & McDermott, M. P. (2002). Statistics & Probability Letters, 60, 183–190.
- Liu, Y., & Xie, J. (2020). Cauchy combination test. Journal of the American Statistical Association, 115, 393–402.
- Donoho, D., & Jin, J. (2004). Higher criticism for detecting sparse heterogeneous mixtures. Annals of Statistics, 32, 962–994.
- Mudholkar, G. S., & George, E. O. (1979). The logit statistic for combining probabilities. In Optimizing Methods in Statistics, 345–366.
From the CodeSplash method registry · meta.combine_p v1.1.0.