08-02: Exercises — Sampling Distributions and the Central Limit Theorem¶
Notes reference: 08-02: Sampling Distributions and the Central Limit Theorem
Q1: Standard error¶
A population has μ = 80 and σ = 15. Find the mean and standard error of x̄ for:
n |
μ_x̄ |
σ_x̄ |
|---|---|---|
| 9 | ? | ? |
| 25 | ? | ? |
| 100 | ? | ? |
| 400 | ? | ? |
Solution
n |
μ_x̄ |
σ_x̄ = σ/√n |
|---|---|---|
| 9 | 80 | 15/3 = 5.000 |
| 25 | 80 | 15/5 = 3.000 |
| 100 | 80 | 15/10 = 1.500 |
| 400 | 80 | 15/20 = 0.750 |
The MEAN never changes — x̄ is unbiased at every sample size.
The SPREAD shrinks with √n:
n × 4 → standard error ÷ 2 (25 → 100: 3.0 → 1.5)
n × 16 → standard error ÷ 4 (25 → 400: 3.0 → 0.75)
To HALVE the standard error you must QUADRUPLE the sample.
Q2: One value vs. a mean¶
Package weights have μ = 500 g and σ = 20 g, normally distributed.
P(one package weighs more than 508 g)P(the mean of 25 packages exceeds 508 g)- Why are these so different?
Solution
1. ONE PACKAGE — use σ
z = (508 − 500)/20 = 0.40
P(Z > 0.40) = 1 − 0.6554 = 0.3446 → 34.46%
2. A MEAN OF 25 — use σ/√n
σ_x̄ = 20/√25 = 20/5 = 4.0
z = (508 − 500)/4.0 = 2.00
P(Z > 2.00) = 1 − 0.9772 = 0.0228 → 2.28%
3. A single package easily runs 8 g heavy — that is well inside normal
variation. But for the AVERAGE of 25 packages to run 8 g heavy, the
heavy ones must not be cancelled by light ones. Averaging shrinks the
noise by a factor of √25 = 5, so the same 8 g gap is 5× more standard
errors out.
THIS IS THE ENGINE OF EVERY HYPOTHESIS TEST: a difference that is
unremarkable in one observation becomes decisive in a mean.
=1-NORM.DIST(508, 500, 20, TRUE) ' 0.344578 — one package
=1-NORM.DIST(508, 500, 20/SQRT(25), TRUE) ' 0.022750 — the mean of 25
pnorm(508, 500, 20, lower.tail = FALSE) # 0.3446
pnorm(508, 500, 20/sqrt(25), lower.tail = FALSE) # 0.0228
Q3: Does the CLT apply?¶
For each, say whether the sampling distribution of x̄ is approximately normal.
n = 10from a normal populationn = 10from a strongly right-skewed populationn = 45from a strongly right-skewed populationn = 200from an unknown, possibly bimodal populationn = 12from a roughly symmetric population
Solution
1. YES — EXACTLY normal. Sampling from a normal population gives a
normal x̄ at ANY n, no CLT needed.
2. NO — n = 10 is far too small to overcome strong skew. The sampling
distribution will still be visibly right-skewed.
3. YES — n = 45 ≥ 30 satisfies the usual rule of thumb.
4. YES — n = 200 is ample. Bimodality in the POPULATION does not survive
averaging; x̄ still becomes unimodal and normal.
5. YES (approximately) — with a roughly symmetric population, n ≥ 15 is
generally enough.
RULE OF THUMB SUMMARY
population normal → any n
roughly symmetric → n ≥ 15
skewed / unknown → n ≥ 30
extremely skewed → n > 50, and check with a Q-Q plot
Q4: Interval for a sample mean¶
Battery life is μ = 42 hours with σ = 6 hours. A sample of 36 is taken.
P(x̄ < 40)P(41 < x̄ < 43)- The middle 95% of sample means
- The value
x̄exceeds only 5% of the time
Solution
σ_x̄ = 6/√36 = 6/6 = 1.0
1. z = (40 − 42)/1.0 = −2.00
P(Z < −2.00) = 0.0228 → 2.28%
2. z₁ = (41 − 42)/1.0 = −1.00
z₂ = (43 − 42)/1.0 = +1.00
P = 0.8413 − 0.1587 = 0.6826 → 68.26%
3. 42 ± 1.96(1.0) = 42 ± 1.96 → (40.04, 43.96) hours
4. z = 1.6449 → x̄ = 42 + 1.6449(1.0) = 43.64 hours
=NORM.DIST(40, 42, 6/SQRT(36), TRUE) ' 0.022750
=NORM.DIST(43,42,1,TRUE)-NORM.DIST(41,42,1,TRUE) ' 0.682689
=NORM.INV(0.025, 42, 1) & " to " & NORM.INV(0.975, 42, 1)
=NORM.INV(0.95, 42, 1) ' 43.6449
Q5: Sampling distribution of a proportion¶
35% of a city's households own a dog. A random sample of 400 households is drawn.
- Check the conditions.
μ_p̂andσ_p̂P(p̂ > 0.40)P(0.32 < p̂ < 0.38)
Solution
1. np = 400(0.35) = 140 ≥ 5 ✓
n(1−p) = 400(0.65) = 260 ≥ 5 ✓
Sample is well under 5% of the city ✓
→ the normal approximation is valid
2. μ_p̂ = p = 0.35
σ_p̂ = √(0.35 × 0.65 / 400) = √(0.2275/400) = √0.00056875 = 0.023848
3. z = (0.40 − 0.35)/0.023848 = 2.0966
P(Z > 2.10) = 1 − 0.9821 = 0.0179 → 1.79%
4. z₁ = (0.32 − 0.35)/0.023848 = −1.2580
z₂ = (0.38 − 0.35)/0.023848 = +1.2580
P = 0.8958 − 0.1042 = 0.7916 → 79.16%
=SQRT(0.35*0.65/400) ' 0.023848
=1-NORM.DIST(0.40, 0.35, 0.023848, TRUE) ' 0.018019
=NORM.DIST(0.38,0.35,0.023848,TRUE)-NORM.DIST(0.32,0.35,0.023848,TRUE)
' 0.791617
se <- sqrt(0.35 * 0.65 / 400)
pnorm(0.40, 0.35, se, lower.tail = FALSE) # 0.01802
pnorm(0.38, 0.35, se) - pnorm(0.32, 0.35, se) # 0.79162
Q6: Work backwards to n¶
A process has σ = 12. How large must n be so that the standard error of x̄ is at most 2?
Solution
σ/√n ≤ 2
12/√n ≤ 2
√n ≥ 6
n ≥ 36
n = 36.
For a standard error of 1: √n ≥ 12 → n ≥ 144.
For a standard error of 0.5: √n ≥ 24 → n ≥ 576.
Halving the target standard error QUADRUPLES the required sample.
This √n economics is the single most important practical fact about
sample size — it is why precision gets expensive fast.
Q7: Simulate the CLT¶
Start from a strongly right-skewed population and show that x̄ becomes normal as n grows.
Solution
set.seed(42)
population <- rexp(100000, rate = 1/10) # mean 10, sd 10, right-skewed
c(mean = mean(population), sd = sd(population))
draw <- function(n, reps = 5000) replicate(reps, mean(sample(population, n)))
m1 <- draw(1); m5 <- draw(5); m30 <- draw(30); m100 <- draw(100)
par(mfrow = c(2, 2))
hist(m1, breaks = 50, col = "#8A5FBF", border = NA, main = "n = 1")
hist(m5, breaks = 50, col = "#5B2A86", border = NA, main = "n = 5")
hist(m30, breaks = 50, col = "#0B7A7A", border = NA, main = "n = 30")
hist(m100, breaks = 50, col = "#0FA3A3", border = NA, main = "n = 100")
par(mfrow = c(1, 1))
data.frame(
n = c(1, 5, 30, 100),
sim_mean = c(mean(m1), mean(m5), mean(m30), mean(m100)),
sim_se = c(sd(m1), sd(m5), sd(m30), sd(m100)),
theory_se = 10 / sqrt(c(1, 5, 30, 100))
)
TYPICAL OUTPUT
n sim_mean sim_se theory_se
1 10.0 10.0 10.00
5 10.0 4.5 4.47
30 10.0 1.8 1.83
100 10.0 1.0 1.00
THREE THINGS TO NOTICE
1. The MEAN is 10 at every n — x̄ is unbiased.
2. The simulated SE matches σ/√n almost exactly.
3. The SHAPE goes from strongly right-skewed (n = 1) to visibly
bell-shaped by n = 30 — that is the Central Limit Theorem.
rng = np.random.default_rng(42)
population = rng.exponential(scale=10, size=100_000)
def draw(n, reps=5000):
return rng.choice(population, size=(reps, n)).mean(axis=1)
for n in (1, 5, 30, 100):
m = draw(n)
print(n, round(m.mean(), 2), round(m.std(ddof=1), 2), round(10/np.sqrt(n), 2))
' 1. Column A: 1,000 exponential values =-LN(RAND())*10
' 2. Columns C..AF: 30 more such columns (each ROW is one sample of 30)
' 3. Column AH: =AVERAGE(C2:AF2) the mean of each sample
' 4. Histogram column A → strongly right-skewed
' Histogram column AH → bell-shaped and much narrower
=STDEV.S(AH2:AH1001) ' ≈ 10/√30 = 1.83
Q8: Explain the difference¶
A colleague says: "The CLT means that with a big enough sample, my data will be normally distributed."
Correct them.
Solution
WRONG. Increasing n does NOT change the shape of the raw data. A sample
of a million incomes is still right-skewed — it just estimates the
skewed population shape more precisely.
RIGHT. The CLT is about the SAMPLING DISTRIBUTION OF A STATISTIC.
It says that the distribution of x̄ ACROSS REPEATED SAMPLES approaches
normal as n grows, whatever the population shape.
THE THREE DISTRIBUTIONS, KEPT STRAIGHT
1. POPULATION distribution — spread σ, any shape. Fixed.
2. SAMPLE distribution — spread s, mimics the population shape.
Bigger n → LOOKS MORE LIKE the population.
3. SAMPLING distribution of x̄ — spread σ/√n, approaches NORMAL.
Bigger n → NARROWER and MORE NORMAL.
WHY IT MATTERS: the t-test, z-test, and confidence interval all assume
#3 is normal. They do NOT require #1 or #2 to be normal — which is what
makes them usable on messy real-world data.
⬅️ Previous: 08-01: Exercises — Sampling Methods and Bias ➡️ Next: 09-01: Exercises — Confidence Interval for a Mean