BIO 202, Spring 2026 — draft v1. Build the bell from coin flips. Discover that the mean is the best constant prediction when you have no other information. Meet the formula y ~ Normal(μ, σ) at the end and see that it is just what you have been doing the whole time.
When you do not know the answer, what is your best single guess, and how wrong will you typically be? Build the answer four ways: coins, simulated heights, a head-to-head between two predictors, and finally a real dataset.
Pick a number. Flip 20 coins. See how close you got. Do it three times.
Pick how many heads you expect, on the right. Then click Flip Coin until you have flipped 20. Three rounds; the running tally below tracks how close you were each time.
A guess of 10 counts as ✓ only when 10 heads actually come up. That happens about 1 round in 6. Watch what's happening to your guesses themselves across the three rounds even when individual rounds come up ✗.
How many heads do you expect to see in 20 single coin flips?
set.seed(42)flips <- rbinom(20, size = 1, prob = 0.5)sum(flips) # count of heads
How far off each round's prediction was from the actual heads count.
| Round | You predicted | Heads observed | Off by |
|---|
Average error across 3 rounds: —
That last column — how far off each prediction was — is the error. The number underneath it is your average error across the three rounds.
A good predictor doesn't hit zero on every single try (luck of the draw still bites). What it does is land with an average error near zero — being too high about as often as too low. Stage B turns this into a running tracker.
Real human heights. Get the average error low across 30 or more draws to move on.
Pick a single guess (in centimeters) for the height of a random adult. Click Draw to pull one. Repeat. If your average error across 30 draws ends up low — close enough to zero — you move on. If not, the page resets.
# 30 random adult heights from real data.nh <- read.csv("data/clean/nhanes_adults.csv")set.seed(7)truths <- sample(nh$Height, 30)guess <- ___ # type a value; aim for an average error near zeromean(guess - truths)
Two numbers behind everything you have done so far.
Click Draw one adult. Each click pulls one real NHANES height and adds its distance from the population mean to the second plot.
In Stage B you found the height that made your average error fall toward zero. That number has a name. Which is it?
Top: the whole adult population. The solid red line is μ — the same number your Stage B average error settled around. The shaded band is ± σ — a typical distance any single adult sits from μ.
Bottom: the error of each draw (truth − μ). After enough draws, this distribution has width σ, centered at zero.
yi ~ Normal(μ, σ)
nh <- read.csv("data/clean/nhanes_adults.csv")y <- nh$Heightmean(y); sd(y) # μ and σ from real datahist(y, breaks = 40, freq = FALSE, col = "gray85", border = "white")abline(v = mean(y), col = "#b23a48", lwd = 2)abline(v = mean(y) + c(-1, 1) * sd(y), col = "#b23a48", lty = 3)
Open the downloaded .R and change nh$Height to nh$Weight. Compute μ and σ on weights. Compute the median as well. Which one — mean or median — is closer to "typical weight"? Plot both as vertical lines on the histogram.