Skip to content
svgqr-process

Quantile process

Does a predictor's effect change across the outcome's distribution?

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

How to read it

  1. Read one panel per predictor; the x axis is the quantile τ.
  2. Compare the line with the dashed OLS estimate.
  3. A rising line means the predictor's effect is stronger in the upper part of the outcome.
  1. Callout 1: The coefficient at low quantiles.
  2. Callout 2: It grows across quantiles here.
  3. Callout 3: Dashed lines: the OLS estimate and interval.

Watch out

  • Extreme quantiles have wide bands with few rows: don't over-read their ends.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the engine's numbers as given (precomputed by the Python or R analysis); the chart computes nothing inferential.
  • One panel per term (up to six); bands are the engine's pointwise intervals (nid / kernel SEs or the rank inversion), not simultaneous bands.
  • A flat process inside the OLS band means the predictor shifts the whole distribution; a slope means it changes the spread or shape.
# Quantile process — Codesplash Chart Lab (recipe "qr-process")
# 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("qr-process-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["term"] = pd.Categorical(df["term"].astype("string"), categories=["income", "household size"])

_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")
def levels_of(s):
    """Declared level order (categoricals), else order of first appearance."""
    if isinstance(s.dtype, pd.CategoricalDtype):
        return [v for v in s.cat.categories if (s == v).any()]
    return list(dict.fromkeys(s.dropna().astype(str)))
T = "tau"
E = "coefficient"
LO = "low"
HI = "high"
TERM = "term"
O = "OLS"
OL = "OLS low"
OH = "OLS high"
d = df.dropna(subset=[T, E])
terms = levels_of(d[TERM])[:6] if TERM else [None]
cols = 1 if len(terms) <= 1 else 2 if len(terms) <= 4 else 3
rows = int(np.ceil(len(terms) / cols))
fig, axes = plt.subplots(rows, cols, figsize=(4.2 * cols, 3 * rows), squeeze=False)
for ax, term in zip(axes.flat, terms):
    s = (d[d[TERM].astype(str) == str(term)] if TERM else d).sort_values(T)
    if LO and HI:
        ax.fill_between(s[T], s[LO], s[HI], color=PALETTE[0], alpha=0.18, lw=0)
    ax.plot(s[T], s[E], color=PALETTE[0], marker="o", markersize=3)
    if O and s[O].notna().any():
        ax.axhline(s[O].dropna().iloc[0], color=REF, linestyle="--")
        if OL and OH:
            ax.axhline(s[OL].dropna().iloc[0], color=REF, linestyle=":")
            ax.axhline(s[OH].dropna().iloc[0], color=REF, linestyle=":")
    ax.axhline(0, color=GREY, linewidth=0.8)
    ax.set_title(str(term) if term is not None else E, fontsize=9, loc="left")
    ax.set_xlabel("quantile τ")
for ax in list(axes.flat)[len(terms):]:
    ax.set_visible(False)
plt.show()

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