← all tools

frequentist vs bayesian

two ways to estimate a basketball player's free-throw rate — change the inputs and watch both update

two ways to learn from data.
  • frequentist (the textbook approach): give one best guess and a range. the range is not the probability the truth is inside it — it's a procedure that, over many repeats, covers the truth 95% of the time.
  • bayesian (the belief-updating approach): start with what you believed before, fold in what you saw, end with an updated belief curve. the 95% range really does mean "95% chance the truth is here, given what we believed and what we saw."
  • change the inputs below and watch both methods react.

try a scenario

what you observed

made out of attempted — 70.0% observed

what you believed before seeing the data

results

the textbook approach (frequentist)

best single guess —
textbook 95% range
(normal approximation)
—
more accurate 95% range
(works at small n / extremes)
—

the range is not the probability the true rate is inside it. it's a procedure that, over many repeats, covers the truth 95% of the time.

the belief-updating approach (bayesian)

updated best guess
(posterior mean)
—
most-likely single value
(posterior mode)
—
95% credible range
(2.5–97.5% interval)
—
chance the true rate is above 75% —

there is a 95% chance the true rate sits in the shaded band, given what you believed and what you saw.

picture

horizontal axis: true free-throw rate (0–100%). the shaded band is the 95% credible interval. the whiskers under the axis are the two frequentist 95% ranges.

what changed

—

—

—

method, formulas, references

The free-throw count is treated as a binomial outcome: k makes out of n attempts, with unknown success rate p. Both methods estimate p, but with different philosophies.

Frequentist. Best single guess is the sample proportion. Two 95% confidence intervals are shown:

p̂ = k / n

Wald  (textbook normal approx.):
  pĢ‚ ± 1.96 Ā· √( pĢ‚ (1 āˆ’ pĢ‚) / n )

Wilson (small-n / extreme-rate safe):
  ( pĢ‚ + z²/2n  ±  z Ā· √( pĢ‚(1āˆ’pĢ‚)/n + z²/4n² ) ) / ( 1 + z²/n )

Wald is the formula in most introductory textbooks. It misbehaves at small n or when p̂ is near 0 or 1, sometimes producing endpoints outside [0, 1]. Wilson stays inside [0, 1] and has better coverage. Both are intervals on the procedure, not probability statements about p.

Bayesian. A Beta prior on p is conjugate to the binomial likelihood, so the posterior is also a Beta distribution with simple updates:

prior:        p ~ Beta(α₀, β₀)
likelihood:   k ~ Binomial(n, p)
posterior:    p | data ~ Beta(α₀ + k,  β₀ + n āˆ’ k)

posterior mean = (α₀ + k) / (α₀ + β₀ + n)
posterior mode = (α āˆ’ 1) / (α + β āˆ’ 2),  when α, β > 1
95% credible interval = 2.5% and 97.5% quantiles of the posterior

The presets parameterise the prior as a mean μ₀ and a "strength" Īŗā‚€ (interpretable as equivalent shots already seen): α₀ = μ₀·κ₀, β₀ = (1 āˆ’ μ₀)Ā·Īŗā‚€. Uninformative is Beta(1, 1) (uniform on [0, 1]). The "vague" preset is μ₀ = 0.75, Īŗā‚€ = 10; the "strong" preset is μ₀ = 0.75, Īŗā‚€ = 80.

Posterior densities and quantiles are computed numerically on a 401-point grid in [0, 1] (no gamma function needed). The likelihood curve in the chart is rescaled to share the posterior's peak height — this is a visual aid to compare shapes; the y-axis has no meaningful units.

References.

  • Gelman, Carlin, Stern, Dunson, Vehtari, Rubin. Bayesian Data Analysis (3rd ed.), 2013 — Beta-Binomial conjugacy, credible intervals.
  • Brown, Cai & DasGupta (2001). "Interval Estimation for a Binomial Proportion." Statistical Science 16(2): 101–133 — why Wald fails and Wilson is preferred.
  • Wilson, E. B. (1927). "Probable Inference, the Law of Succession, and Statistical Inference." JASA 22(158): 209–212.