Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This week in one line: you’ll learn why two honest random samples give two different numbers (sampling variability), and how to put a number on the typical size of that wobble (the standard error).

Two campus newspapers, on the same afternoon, each poll 50 different students at random about a proposed increase to the student recreation fee. Reporter A’s sample finds 52% in favor. Reporter B’s sample finds 50% in favor. Both reporters did everything right — a genuine random sample, the same question, the same day. So why don’t their numbers match, and which one (if either) is “correct”?

This week starts Chapter 5, the conceptual heart of the semester. Any number you compute from a sample — a percentage, an average — behaves a little like rolling a dice: draw a different sample and you get a different number, purely from the luck of who happened to get picked. Once you can say precisely how much that number typically wobbles from sample to sample, you have everything you need for the confidence intervals and hypothesis tests that fill the rest of this course.

1From guess to typical guess: parameter vs. point estimate

A parameter is a number that describes an entire population — every student at CSUB, every part a factory makes, every possible flip of a coin. Parameters are usually unknown, often unknowable directly. Two you’ll use constantly: the population proportion pp (the fraction of the population with some trait) and the population mean μ\mu (the average of some numerical variable across the population).

A statistic is the matching number computed from a sample — the smaller group you actually got to observe. The point estimate is a statistic used as your single best guess at the parameter: the sample proportion p^\hat p (“p-hat”) estimates pp, and the sample mean xˉ\bar x (“x-bar”) estimates μ\mu.

Worked Example 1 — A campus fee referendum. To make the population visible for teaching (something you never get in real research), suppose a population of N=20,000N=20{,}000 CSUB students has a true proportion p=0.55p=0.55 supporting the fee measure — 11,000 support it, 9,000 oppose it (fee_poll_sim, a simulated population built with set.seed(1209)). Reporter A’s random sample of n=50n=50 students finds p^=0.52\hat p = 0.52 (26 of 50 in favor). Here p=0.55p=0.55 is the parameter — fixed, and in real life unknown — while p^=0.52\hat p=0.52 is the point estimate: Reporter A’s one honest guess at pp, built entirely from the 50 students she happened to draw.

2Same recipe, different sample: the sampling distribution

Reporter B follows the exact same recipe — random sample, n=50n=50, same population — and gets p^=0.50\hat p = 0.50 (25 of 50). Neither reporter made a mistake. This is sampling variability: a statistic computed from a random sample naturally differs from one sample to the next, purely because a different set of people was drawn. If you could repeat Reporter A’s poll thousands of times, each repetition’s p^\hat p would land somewhere slightly different, and the full collection of those values is called the sampling distribution of p^\hat p — the distribution of a statistic’s value across every possible sample of a given size.

You can’t poll a real population a thousand times, but because we built the whole population for this example, R can simulate it: draw 1,000 separate random samples of n=50n=50 and record each one’s p^\hat p.

Histogram of 1,000 simulated sample proportions (samples of n = 50) is roughly bell-shaped and symmetric, centered close to 0.55, and ranges from about 0.32 to 0.76; a dashed line marks the true proportion 0.55.

Figure 1. A histogram of 1,000 simulated p^\hat p values (samples of n=50n=50) is roughly bell-shaped and symmetric, centered close to 0.55, and ranges from about 0.32 to 0.80. The average of all 1,000 estimates is 0.549 — almost exactly the true p=0.55p=0.55 — showing that p^\hat p doesn’t systematically run high or low. A statistic with that property is called unbiased.

3Standard error: putting a number on the wobble

The standard error (SE) is the standard deviation of a sampling distribution — the typical distance a statistic lands from its parameter, measured in the statistic’s own units. For a sample proportion:

SEp^=p(1p)nSE_{\hat p} = \sqrt{\frac{p(1-p)}{n}}

where pp is the population proportion and nn is the sample size (in practice p^\hat p substitutes for the unknown pp). For a sample mean:

SExˉ=σnSE_{\bar x} = \frac{\sigma}{\sqrt{n}}

where σ\sigma is the population standard deviation (in practice the sample SD ss substitutes for the unknown σ\sigma). For the fee poll, SEp^=0.55(0.45)/50=0.0704SE_{\hat p} = \sqrt{0.55(0.45)/50} = 0.0704 — almost exactly the standard deviation of the 1,000 simulated p^\hat p’s from Figure 1, which was 0.0707.

Worked Example 2 — Coffee price on campus. Build a second hypothetical population: N=20,000N=20{,}000 purchase amounts (coffee_price_sim) generated from a Normal model targeting μ=$4.25\mu=\$4.25, σ=$1.10\sigma=\$1.10 (the realized population lands at mean $4.25\$4.25, SD $1.11\$1.11 — indistinguishable from the target for teaching purposes). One sample of n=30n=30 purchases gives xˉ=$4.07\bar x = \$4.07; a second sample of n=30n=30 gives xˉ=$4.10\bar x = \$4.10 — again, two honest estimates, two different numbers. Simulating 1,000 samples of n=30n=30 gives a sampling distribution of xˉ\bar x centered at $4.24\$4.24 with SD $0.204\$0.204, matching the formula: SExˉ=1.10/30=0.201SE_{\bar x} = 1.10/\sqrt{30} = 0.201.

Now quadruple the fee-poll sample to n=200n=200: SEp^=0.55(0.45)/200=0.0352SE_{\hat p} = \sqrt{0.55(0.45)/200} = 0.0352 — exactly half of the n=50n=50 value. Because nn sits under a square root, multiplying the sample size by 4 divides the SE by 4=2\sqrt 4 = 2. The same shrinking pattern holds for the mean: bumping the coffee-price sample from n=30n=30 to n=100n=100 shrinks the simulated spread from $0.204\$0.204 to $0.109\$0.109, matching SExˉ=1.10/100=0.11SE_{\bar x}=1.10/\sqrt{100}=0.11. Bigger samples give more precise — not more accurate, more precise — point estimates, because a larger nn shrinks the typical wobble around whatever value the sample happens to be centered on.

A second histogram of 1,000 simulated sample proportions, now from samples of n = 200, is visibly narrower than the n = 50 histogram while still centered near 0.55; a dashed line marks the true proportion 0.55.

Figure 2. A second histogram of 1,000 simulated p^\hat p’s, now from samples of n=200n=200, is visibly narrower than Figure 1’s — spread (SD) about 0.035 versus 0.071 — while still centered near 0.55.

4Same shape every time: the Central Limit Theorem

Look back at Figure 1: the variable behind it is about as far from bell-shaped as a variable can be — each student either supports the measure or doesn’t; a coin flip has no “shape.” Yet the sampling distribution of p^\hat p came out bell-shaped anyway. That’s the Central Limit Theorem (CLT): for a large enough sample size, the sampling distribution of a sample proportion or sample mean is approximately Normal, centered at the true parameter, regardless of the shape of the underlying population. “Large enough” is the condition the rest of this course is built on — Chapter 6 checks it with a success–failure count for proportions, Chapter 7 with a sample-size/skew check for means — but this week’s main idea is simpler: once nn is reasonably large, you can trust the bell shape and the SE formula to describe how a point estimate behaves, which is exactly what makes a confidence interval (next week) possible.

Two histograms of simulated sample means for the coffee-price example, n = 30 and n = 100, drawn on the same horizontal scale: both are bell-shaped and centered near $4.25, and the n = 100 histogram is visibly the narrower of the two.

Figure 3. Two histograms of simulated xˉ\bar x’s for the coffee-price example, n=30n=30 and n=100n=100, drawn on the same horizontal scale: both are bell-shaped and centered near $4.25\$4.25, and the n=100n=100 histogram is visibly the narrower of the two — the same square-root shrinkage seen in Figures 1–2, now for a mean instead of a proportion.

See it in R.

library(mosaic)
set.seed(1209)

# Worked Example 1: sampling distribution of p-hat, n = 50, true p = 0.55
sim_phat_50 <- do(1000) * mean(~support, data = resample(fee_poll_sim, size = 50))
favstats(~mean, data = sim_phat_50)
gf_histogram(~mean, data = sim_phat_50)

# same population, n = 200 (Figure 2)
sim_phat_200 <- do(1000) * mean(~support, data = resample(fee_poll_sim, size = 200))
favstats(~mean, data = sim_phat_200)

# Worked Example 2: sampling distribution of x-bar, n = 30 and n = 100
sim_xbar_30  <- do(1000) * mean(~price, data = resample(coffee_price_sim, size = 30))
sim_xbar_100 <- do(1000) * mean(~price, data = resample(coffee_price_sim, size = 100))
favstats(~mean, data = sim_xbar_30)
favstats(~mean, data = sim_xbar_100)

Running this exact code (set.seed(1209), mosaic 1.9.2) reproduces every number in this week’s reading: sim_phat_50 comes back with mean 0.549 and SD 0.0707; sim_phat_200 with mean 0.551 and SD 0.0349; sim_xbar_30 with mean 4.243 and SD 0.204; sim_xbar_100 with mean 4.248 and SD 0.109.

5Check your understanding

  1. In Worked Example 1, p=0.55p=0.55 and Reporter A’s sample gave p^=0.52\hat p = 0.52. Which of these two numbers is the parameter and which is the point estimate? Explain the difference between them in your own words.

  2. Reporter B’s sample (same population, same n=50n=50) gave p^=0.50\hat p = 0.50 — different from Reporter A’s 0.52, even though both sampled the exact same population the exact same way. Is this difference a sign that one reporter made a sampling mistake? Explain, using the term sampling variability.

  3. Compute SEp^=p(1p)/nSE_{\hat p} = \sqrt{p(1-p)/n} for the fee-poll population (p=0.55p=0.55) at n=50n=50 and again at n=200n=200. By what factor did nn increase, and by what factor did the SE decrease? Compare each answer to the simulated spreads reported in this week’s reading (0.0707 and 0.0349).

  4. Compute SExˉ=σ/nSE_{\bar x} = \sigma/\sqrt n for the coffee-price population (σ=$1.10\sigma=\$1.10) at n=30n=30 and again at n=100n=100. Compare each answer to the simulated spreads reported in this week’s reading ($0.204\$0.204 and $0.109\$0.109).

  5. The variable behind Figure 1 — whether a student supports the fee measure — is binary, nothing like a bell curve. Yet the histogram of 1,000 simulated p^\hat p’s came out roughly bell-shaped and centered near p=0.55p=0.55. Name the principle that explains this pattern, and state it in your own words.

  6. A classmate says: “Since the SE for n=100n=100 coffee-price samples ($0.109\$0.109) is smaller than the SE for n=30n=30 samples ($0.204\$0.204), every single sample of 100 will land closer to the true mean ($4.25\$4.25) than every single sample of 30.” Explain what’s wrong with this claim, using the idea that a standard error describes typical variability, not a guarantee.

6Key terms