POSTECH · CSED105 · LECTURE 5

MLE and MAP: A Coin Toss Activity

Assume the coin has the same chance of heads on every toss. Change your starting belief and the toss results to compare two estimates.

1. Choose a starting belief about the coin.

2. Add the tosses you observed.

3. Compare MLE and MAP.

Before the new tosses: choose a prior

A prior describes what we think about the coin before seeing these tosses.

Beta(α, β) is a family of curves for describing this starting belief. Increase α to favor more heads; increase β to favor more tails.

After the tosses: enter what you saw

Let D be the tosses we observed. For example, HHH means three heads and no tails.

Compare the estimates

MLE uses only the tosses. MAP uses the tosses and your starting belief.

MLE1.000The heads fraction in the observed tosses.
MAP0.588The peak of the updated belief, after combining prior and tosses.
How your belief changes
Before tosses: P(p)After tosses: P(p | D)
Prior and updated beliefThe curves change with the selected prior and coin tosses.

Try this: Start with Beta(8, 8) and HHH. Then add more heads. Watch MAP move toward MLE.

Optional: see the formulas

Prior: p ~ Beta(α, β)

After h heads and t tails: p | data ~ Beta(α + h, β + t)

MLE = h / (h + t)    MAP = (α + h − 1) / (α + β + h + t − 2)

The MAP formula above applies when both updated parameters exceed 1. At an edge, MAP can be 0 or 1. With no tosses, MLE is undefined.

Likelihood: L(p; data) ∝ ph(1 − p)t