Skip to content
svgbf-robustness

Bayes factor robustness

Would a wider or narrower prior change the conclusion?

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

How to read it

  1. Read the curve as the Bayes factor at each prior width.
  2. Find your chosen width on the curve.
  3. If the curve stays in one evidence band across widths, the conclusion doesn't depend on the prior width.
  1. Callout 1: Your chosen prior width.
  2. Callout 2: Evidence band labels.
  3. Callout 3: The BF = 1 line: no evidence either way.

Watch out

  • A range of widths isn't a range of prior shapes: results may still depend on the prior's form.

Defaults

Chosen prior width
0.707
The prior width used in your analysis, marked on the curve.
Range 0 to 100, step 0.01
Log x axis
Off
Space the x axis by ratios, which suits values spanning orders of magnitude.

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₀.
  • Very wide priors favour H₀ (Bartlett–Lindley): a conclusion that holds across the conventional widths is robust; one that flips is prior-sensitive and should be reported as such.
# Bayes factor robustness — Codesplash Chart Lab (recipe "bf-robustness")
# controls: chosen=0.707, logX=false
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-robustness-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 = "prior width r"
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.axvline(0.707, color=REF, linewidth=0.8)

ax.set_xlabel("prior width r")
ax.set_ylabel("BF₁₀ (log scale)")
ax.legend(fontsize=8)
plt.show()

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