Skip to content
svgfstat-sequence

F statistics over candidate breaks

At which date would a break in the regression be most pronounced, and is the largest F beyond chance?

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

How to read it

  1. Read the curve as the F statistic for a break after each candidate date.
  2. The highest point (sup-F) is the most pronounced break.
  3. Compare it with the critical value of the maximum, not the usual F table.
  1. Callout 1: sup-F: the largest F, at the most pronounced break.
  2. Callout 2: Low values: no sign of a break around these dates.

Watch out

  • Searching all dates inflates F, so a usual F table overstates the evidence.

Defaults

5% critical value (0 = none)
0
The critical value of sup-F (the analysis sends a simulated one).
Range 0 to 100, step 0.1

Pinned in the code

  • F_i = (RSS − RSS₁ − RSS₂) / ((RSS₁ + RSS₂)/(n − 2k)) for a break after observation i, i = ⌊πn⌋…⌊(1−π)n⌋, as strucchange::Fstats.
  • The critical line is for the maximum over all candidates — not for any single F — so it sits well above the usual F critical value.
# F statistics over candidate breaks — Codesplash Chart Lab (recipe "fstat-sequence")
# controls: crit=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("fstat-sequence-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")
def ordered(d, x, cols):
    """Rows with the needed values, sorted by the time column (stable); row order when there is none."""
    d = d.dropna(subset=[c for c in cols if c] + ([x] if x else []))
    return d.sort_values(x, kind="stable") if x else d

def time_of(d, x):
    return d[x] if x else pd.Series(np.arange(1, len(d) + 1), index=d.index)
X = "break after"
Y = "F"
CRIT = 0  # 5% critical value of sup-F (0 = none)
d = ordered(df, X, [Y])
t, F = time_of(d, X), d[Y].to_numpy(dtype=float)
i = int(np.argmax(F))
fig, ax = plt.subplots(figsize=(8, 4))
if CRIT > 0:
    ax.axhline(CRIT, color="#ce5342", linestyle="--", label="5% critical value of sup-F")
ax.plot(t, F, color=PALETTE[0], linewidth=1.6)
ax.scatter([t.iloc[i]], [F[i]], color="#ce5342" if CRIT and F[i] > CRIT else PALETTE[3 % len(PALETTE)], zorder=3)
ax.set_title(f"sup-F = {F[i]:.2f} after {t.iloc[i]}", fontsize=10, loc="left")
ax.set_ylim(bottom=0)
ax.set_xlabel("break after")
ax.set_ylabel("F")
plt.show()

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