Skip to content
svginfluence-panel

Influence panel (leave one out)

Is any study an outlier, and how much does the result change without it?

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

How to read it

  1. Read rows as studies, across three panels.
  2. Left: residuals beyond ±1.96 lines are outliers.
  3. Middle: Cook's distance. Right: the pooled estimate without that study.
  1. Callout 1: Outlier: a large residual.
  2. Callout 2: A large Cook's distance.
  3. Callout 3: The estimate without this study.

Watch out

  • Influence isn't a verdict: a very large and good trial may also look influential.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the meta-analysis engine's numbers as given (codesplash.stats.meta in Python ≡ codesplashr in R); the chart computes nothing statistical.
  • Residuals beyond ±1.96 are coloured; the dashed line in the third panel is the estimate from all studies (engine control `pooled`).
  • Ratios are drawn on a log scale (engine control `log`).
# Influence panel (leave one out) — Codesplash Chart Lab (recipe "influence-panel")
# controls: defaults
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("influence-panel-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["study"] = pd.Categorical(df["study"].astype("string"), categories=["Study 1", "Study 2", "Study 3", "Study 4", "Study 5", "Study 6", "Study 7", "Study 8", "Study 9", "Study 10"])

_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")
LABEL = "study"
RS = "studentized residual"
COOKS = "Cook's distance"
EST = "risk ratio without the study"
LOW = "low"
HIGH = "high"
d = df.dropna(subset=[RS, EST]).reset_index(drop=True)
y = np.arange(len(d))[::-1]
fig, axes = plt.subplots(1, 3, figsize=(10, max(3, 0.3 * len(d) + 1.2)), sharey=True)
axes[0].axvline(-1.96, color=REF, linestyle="--", linewidth=1)
axes[0].axvline(1.96, color=REF, linestyle="--", linewidth=1)
axes[0].plot(d[RS], y, "o", color=PALETTE[0], markersize=5)
axes[0].set_xlabel(RS)
axes[1].hlines(y, 0, d[COOKS], color=PALETTE[0], linewidth=1.4)
axes[1].plot(d[COOKS], y, "o", color=PALETTE[0], markersize=4)
axes[1].set_xlabel(COOKS)
if LOW and HIGH:
    axes[2].hlines(y, d[LOW], d[HIGH], color=PALETTE[0], linewidth=1.2)
axes[2].plot(d[EST], y, "o", color=PALETTE[0], markersize=4)
axes[2].set_xlabel(EST)
axes[0].set_yticks(y, d[LABEL].astype(str))
fig.tight_layout()
plt.show()

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