Skip to content
svgbf-sequential

Sequential Bayes factor

How did the evidence grow as the observations came in?

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

How to read it

  1. Read left to right as evidence accumulates.
  2. Rising above 1 favours H₁; falling below 1 favours H₀.
  3. A steady path is reassuring; big swings mean the result rests on a few rows.
  1. Callout 1: The final Bayes factor.
  2. Callout 2: BF = 1: no evidence either way.
  3. Callout 3: Early rows: the path moves a lot.

Watch out

  • The row order is one order among many; another could tell a different story on the way.

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.
  • Shaded bands are Lee & Wagenmakers' (2013) evidence categories after Jeffreys (1961): 1–3 anecdotal, 3–10 moderate, 10–30 strong, 30–100 very strong, above 100 extreme, mirrored below 1 for evidence for H₀.
  • Rows are taken in the dataset's order; Bayes factors may be monitored as data accrue (the likelihood principle), but the prior must not be tuned to the path.
# Sequential Bayes factor — Codesplash Chart Lab (recipe "bf-sequential")
# 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("bf-sequential-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")
CUTS = [1 / 30, 1 / 10, 1 / 3, 1, 3, 10, 30]  # Lee & Wagenmakers (2013) evidence categories
X = "rows"
B = "BF₁₀"
d = df[[X, B]].dropna().query(f"`{B}` > 0").sort_values(X)
fig, ax = plt.subplots(figsize=(7, 4.5))
ax.set_yscale("log")
for cut in CUTS:
    ax.axhline(cut, color=REF, linewidth=1.2 if cut == 1 else 0.4, linestyle="--" if cut == 1 else ":")
ax.plot(d[X], d[B], color=PALETTE[0], linewidth=2, label=f"BF₁₀ (last {d[B].iloc[-1]:.3g})")


ax.set_xlabel("observations so far")
ax.set_ylabel("BF₁₀ (log scale)")
ax.legend(fontsize=8)
plt.show()

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