Concept map / Binomial and normal distributions

Share

Binomial and normal distributions

Compare the binomial distribution of heads with a normal approximation and read normal probabilities as areas.

1Ten flips, counted again and again

Flip a coin ten times and count the heads. Then do it again, and again. Each set of ten flips is one experiment, and its result is a count from 0 to 10. Over many experiments the counts pile up into a shape called the binomial distribution. Each flip is a Bernoulli trial: one outcome, heads or tails.

Run some experiments and watch your blue bars close in on the green marks, the long-run share of each count. Then change n, the number of flips, or p, the chance of heads.

One experiment is 10 flips. Only the number of heads is kept.

Share of experiments with each result012345678910Number of heads in 10 flips
Your experimentsLong-run share (binomial)

No experiments yet. The most likely count is 5, with probability 24.6%.

More controls

2How often is the most likely count?

You flip a fair coin 10 times. Five heads is the result you would expect, and it is the single most likely one. How often do you get exactly five?

3More flips, closer to a bell

The orange curve is a normal distribution with the same center and spread as the bars. Raise n and the bars line up with it. With a lopsided coin, such as p = 0.05, the bars stay skewed for much longer.

Exact distribution (bars) and the bell curve (line)012345678910Number of heads in 10 flipscenter 5.0
center    μ=n pspread    σ=n p (1−p)\begin{gathered} \htmlClass{term-mu}{\text{center}\;\; \mu = n\,p} \\[4pt] \htmlClass{term-sigma}{\text{spread}\;\; \sigma = \sqrt{n\,p\,(1-p)}} \end{gathered}

With 10 flips at p = 0.50, the center is 10 × 0.50 = 5.0 heads and the spread is 1.58. The biggest gap between a bar and the bell's area over that bar is 0.3 percentage points.

Point at a formula to find it on the chart: the blue line is the center, and the gold bar is one spread wide.

4Shares of people are areas under the bell

Under a bell curve, a share of people is an area. Psychometrics often puts the reference population's ability on a scale with mean 0 and standard deviation 1, and this chart also assumes ability is normal. Set a range with the two sliders to find the share of people inside it.

How common each ability isAbility, in standard deviations from the average-4-3-2-10123468.3%

68.3% of people have an ability between −1.00 and 1.00. A person at 1.00 is ahead of 84.1% of the population.

Preset ranges

5Check yourself

The tasks use the controls in sections 1 and 4 and tick themselves when you meet them.

  • Choose n and p so that exactly 3 heads is the most likely result, then run at least 200 experiments to confirm it.Now: Most likely count: 5. 0 experiments run
  • On the bell curve, set a range centered on 0 that holds 90% of people. None of the preset ranges will do it for you.Now: From −1.00 to 1.00 holds 68.3%
  • Find the ability that puts a person ahead of 97.5% of the population (use the upper edge of the range).Now: Someone at 1.00 is ahead of 84.1%

6Binomial and normal probabilities in R

dbinom() gives the exact bar heights and rbinom() runs experiments like the buttons above, for the lab’s starting setup of 10 flips at p = 0.5. Exactly five heads has probability 0.246. pnorm() and qnorm() give the normal areas and the 1.96 cutoff from the last task.

Binomial probabilities and normal areasShow the code
# Ten flips of a fair coin, as on the page
n <- 10
p <- 0.5
# Exact probability of each number of heads
round(setNames(dbinom(0:n, n, p), 0:n), 3)
# Center and spread of the count
round(c(mean = n * p, sd = sqrt(n * p * (1 - p))), 2)

# Run 1,000 experiments and tabulate the share of each count
set.seed(1)
heads <- rbinom(1000, n, p)
table(factor(heads, levels = 0:n)) / 1000

# Normal areas within 1, 2 and 3 SDs of the mean
round(pnorm(1:3) - pnorm(-(1:3)), 3)
# The ability that is ahead of 97.5% of people
round(qnorm(0.975), 2)

Uses base R only.

What the two distributions show