Skip to content
svgpcurve

p-curve

Do the significant results look like they come from real effects (right-skewed) or from selective reporting of null effects (flat or left-skewed)?

Demo data · seed 20261101 · 5 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read only the significant results: each point is the share of their p-values in one .01-wide bin.
  2. A curve that falls from left to right (many very small p-values) is right-skewed, as real effects produce.
  3. A flat curve near 20% looks like no effect; a curve rising towards .05 suggests p-hacking.
  1. Callout 1: Many p-values below .01: right skew.
  2. Callout 2: The flat 20% line: no true effect.
  3. Callout 3: The 33%-power curve: weak evidence.

Watch out

  • p-curve says whether the significant results carry evidential value, not how large the effect is.
  • With only a handful of significant results the bins are coarse; trust the Stouffer tests over the picture.

Defaults

Significant results
0
Number of significant results behind the curve, shown in the legend (0 hides it).
Range 0 to 100,000, step 1

Pinned in the code

  • Draws the meta-analysis engine's numbers as given (codesplash.stats.meta_lab in Python ≡ codesplashr in R); the chart computes nothing statistical.
  • Bins are (0, .01], (.01, .02], … (.04, .05] of two-sided p-values from results significant in the favoured direction.
  • With no true effect p-values are uniform below .05, so every bin holds 20%. The 33%-power curve is what studies with power 1/3 would give (z tests, as χ²(1)).
# p-curve — Codesplash Chart Lab (recipe "pcurve")
# controls: k=0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]

df = pd.read_csv("pcurve-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV

BIN = "p-value"
OBS = "observed %"
NULL = "no effect %"
P33 = "33% power %"
K = 0  # significant results behind the curve (0 = not shown)
d = df.dropna(subset=[BIN, OBS]).sort_values(BIN)
ticks = [f"{b:.2f}".lstrip("0") for b in d[BIN]]
x = np.arange(len(d))
fig, ax = plt.subplots(figsize=(6.5, 4.5))
if NULL:
    ax.plot(x, d[NULL], color=PALETTE[3], linestyle=":", linewidth=1.4, label="no effect")
if P33:
    ax.plot(x, d[P33], color=PALETTE[2], linestyle="--", linewidth=1.4, label="33% power")
ax.plot(x, d[OBS], color=PALETTE[0], linewidth=2.2, marker="o", label=f"observed ({K:g} significant)" if K else "observed")
for xi, v in zip(x, d[OBS]):
    ax.annotate(f"{v:.0f}%", (xi, v), textcoords="offset points", xytext=(0, 7), ha="center", fontsize=8)
ax.set_xticks(x, ticks)
ax.set_ylim(0, 100)
ax.set_xlabel(f"p-value (bin upper edge; {BIN})")
ax.set_ylabel(f"share of significant results (%; {OBS})")
ax.legend(frameon=False)
plt.show()

Needs pandas, numpy, matplotlib · reads pcurve-demo.csv · app theme from the optional codesplash helper