Visualizing the binomial: from bars to a bell curve

Self-paced bonus activity · plot the binomial PMF and watch the CLT appear

Welcome to a self-paced bonus activity. In the M06 pre-study you used dbinom() and pbinom() to compute individual binomial probabilities — the chance of getting exactly 3, or at most 1, articles with an exclamation mark out of 5. This activity is about seeing the whole distribution: you’ll plot the full binomial PMF as a bar chart, then crank up \(n\) and watch that skewed little bar chart morph into a smooth bell curve — the Central Limit Theorem in action. Everything happens on this page — nothing here goes into your lab notebook, and none of it is graded.

We use the same running example as the pre-study: you randomly select articles from a source where the probability that any given article has an exclamation mark in the title is \(p = 18/150 = 0.12\). Let \(X\) = the number of articles (out of \(n\)) with an exclamation mark. Then \(X \sim \text{Binomial}(n, p)\).

What you’ll do

  • Plot the full binomial PMF for \(n = 5\), \(p = 0.12\) — all six bars at once
  • Increase \(n\) to 25, then 500, and watch the shape become normal

Activity 1 — Plot the full PMF

Video 4’s slides showed the full binomial PMF as a bar chart with 6 bars (one for each \(k = 0, 1, 2, 3, 4, 5\)). Let’s reproduce it. Rather than call dbinom() six times, we pass a vector to the x argument:

Your task: fill the single blank — the dbinom() call that returns the probability for every value of k at once. Everything else, including the chart, is written for you.

Replace ___ with dbinom(x = 0:n, size = n, prob = p). The vector 0:n means “every integer from 0 through n” — dbinom() returns one probability for each one, so prob becomes a vector of length 6.

The tallest bar is at k = 0, with P ≈ 0.53 — because p is small (0.12), most batches of 5 have zero articles with “!”. This matches the shape you saw in the video.


Activity 2 — Watch it become a bell curve

One of the most important ideas about the binomial — and in statistics in general — is that as \(n\) grows, the binomial PMF starts to look normal. Re-run the Activity 1 code with n <- 25, then n <- 500, keeping \(p\) the same.

Your task: fill the single blank with a value for n, run the cell, then change it and run again — try 25 first, then 500. Watch the shape of the bars as n grows.

Start with n <- 25 and run the chunk. Then change to n <- 500 and run it again. Watch the shape.

That’s the normal approximation to the binomial — a special case of the Central Limit Theorem — in action. A skewed, discrete PMF at \(n = 5\) is, by \(n = 500\), almost perfectly described by a smooth bell curve. Keep this image in mind — it’s the bridge from the binomial to the normal.


Back to the M06 pre-study → return to the pre-study