Skip to content
svghalf-normal-effects

Half-normal plot of effects

Which factor effects in an unreplicated factorial stand out from noise?

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

How to read it

  1. Read points near the line through the origin as noise.
  2. Read points far above and to the right as active effects.
  3. The labels name the factors.
  1. Callout 1: Active effects, far from the line.
  2. Callout 2: Inactive effects, on the line.
  3. Callout 3: The line through the inactive ones.

Watch out

  • Effects are aliased in a fraction: a labelled effect may be another one in disguise.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the run's numbers as given (computed by the Python/R engine); the chart computes nothing statistical.
  • Quantiles are Φ⁻¹(0.5 + 0.5·(i − 0.5)/m) for the i-th smallest of m effects (Daniel 1959); activity is the engine's decision (Lenth's ME by default).
  • The reference line is least squares through the origin on the inactive effects.
# Half-normal plot of effects — Codesplash Chart Lab (recipe "half-normal-effects")
# 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("half-normal-effects-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")
E = "effect"
A = "|effect|"
Q = "half-normal quantile"
S = "active"
d = df.dropna(subset=[A, Q])
sig = d[S].astype(bool)
inert = d[~sig]
slope = (inert[A] * inert[Q]).sum() / (inert[A] ** 2).sum()  # least squares through the origin
fig, ax = plt.subplots(figsize=(8, 4.5))
xs = np.array([0, d[A].abs().max() * 1.1])
ax.plot(xs, slope * xs, color=REF, linestyle="--", linewidth=1)
ax.scatter(d.loc[~sig, A].abs(), d.loc[~sig, Q], color="grey", s=18)
ax.scatter(d.loc[sig, A].abs(), d.loc[sig, Q], color=PALETTE[1], s=30)
for _, r in d[sig].iterrows():
    ax.annotate(str(r[E]), (abs(r[A]), r[Q]), xytext=(-6, 0), textcoords="offset points", ha="right", va="center", fontsize=9, fontweight="bold")
ax.set_ylim(0, d[Q].max() * 1.08)
ax.set_xlabel(A)
ax.set_ylabel(Q)
plt.show()

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