Skip to content
svgselection-weights

Selection-model weight function

How much more likely were studies to be published when their one-sided p-value fell in each interval?

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

How to read it

  1. Read each step as the relative chance that a study with a one-sided p-value in that interval was published.
  2. The first interval is fixed at 1; a step at 0.4 means 40% as likely to be published as a study in the first interval.
  3. Steps near 1 everywhere mean no selection; steps that drop after .025 are what publication bias looks like.
  1. Callout 1: Significant results: weight fixed at 1.
  2. Callout 2: Non-significant results published less often.
  3. Callout 3: Reference line: no selection.

Watch out

  • The weights assume selection acted only on p-values; heterogeneity or small-study effects can mimic them.
  • Wide bands are common with fewer than about 20 studies; compare with fixed Vevea–Woods weights then.

Defaults

Log p axis
On
Log-scaled p axis from .001 to 1 so the .025 and .05 intervals are visible.
Reference weight
1
Horizontal reference: 1 means as likely to be published as the first interval.
Range 0 to 100, step 0.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.
  • Weights are relative to the first interval (fixed at 1). A weight of 0.5 means half as likely to be published as a study in the first interval.
  • Bands are Wald 95% intervals truncated at 0; fixed (a priori) weight functions have no band.
# Selection-model weight function — Codesplash Chart Lab (recipe "selection-weights")
# controls: logP=true, reference=1
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("selection-weights-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV

_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"])  # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"])  # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
LO = "p from"
HI = "p to"
W = "weight"
CL = "CI low"
CH = "CI high"
N = "studies"
LOG_P, REFERENCE = True, 1
d = df.dropna(subset=[LO, HI, W]).sort_values(LO)
x_min = min(0.001, d[HI][d[HI] > 0].min() / 2) if LOG_P else 0
left = d[LO].clip(lower=x_min)
fig, ax = plt.subplots(figsize=(7, 4.5))
if CL and CH:
    for l, h, a, b in zip(left, d[HI], d[CL], d[CH]):
        if np.isfinite(a) and np.isfinite(b):
            ax.fill_between([l, h], a, b, color=PALETTE[0], alpha=0.18, lw=0)
ax.hlines(d[W], left, d[HI], color=PALETTE[0], linewidth=2.4)
if N:
    for l, h, w, n in zip(left, d[HI], d[W], d[N]):
        ax.annotate(f"k = {n:.0f}", (np.sqrt(l * h) if LOG_P else (l + h) / 2, w), textcoords="offset points", xytext=(0, 5), ha="center", fontsize=8)
ax.axhline(REFERENCE, color=REF, linestyle="--", linewidth=1)
if LOG_P:
    ax.set_xscale("log")
ax.set_xlim(x_min, 1)
ax.set_ylim(0, None)
ax.set_xlabel(f"one-sided p-value ({LO} to {HI})")
ax.set_ylabel(f"relative chance of publication ({W})")
plt.show()

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