← Explainer Library

Interactive Explainer

MLE vs MAP, on a Coin Flip

Frequentists and Bayesians have argued for a century. On a single coin, both estimates are one number you can compute. Slide the prior, flip some coins, and watch the estimate drift from MLE (data-only) toward MAP (data + prior).

Step 1

The setup

A coin has unknown bias $p$. You flip it $N$ times and observe $h$ heads, $t = N - h$ tails. The likelihood is $\mathcal{L}(p) = p^h (1-p)^t$. MLE peaks at $\hat p_{\text{MLE}} = h/N$.

Put a $\text{Beta}(\alpha, \beta)$ prior on $p$. Posterior is $\text{Beta}(\alpha + h,\ \beta + t)$ — same family, just add the counts. MAP peaks at the mode of that Beta.

Try it

The widget

Interactive sliders for $\alpha$, $\beta$, true $p$, and $N$ go here.

Plots: likelihood, prior, posterior on the same axis.

Read-out: MLE, posterior mean, MAP, KL(posterior ‖ prior).

Status: scaffold. Implementation pending.

Step 2

What to look for