Week 02 · Sampling distributions and standard error

Predict how the uncertainty of a sample mean changes with sample size.

Watch on YouTube

← Week 1 · Subject contents · Week 3 →

Predict how the uncertainty of a sample mean changes with sample size.

Work through the problem

A Bernoulli observation has standard deviation √[p(1−p)]. The sampling distribution is the distribution of p̂ across repeated samples of a fixed size. Standard error is the standard deviation of that statistic.

For independent trials, Var(ΣXᵢ) = n p(1−p). Dividing by n² gives Var(p̂) = p(1−p)/n. At p = 0.5 and n = 100 the standard error is 0.05, even though the standard deviation of an individual observation is 0.5. When sampling four times as many independent observations, the standard error halves.

More observations reduce standard error. Standard error by sample size. Series: Theory, Simulation.

More observations reduce standard error.

Run the Python lab

import numpy as np
rng = np.random.default_rng(21)
sizes = np.array([25, 100, 400])
empirical = np.array([np.std(rng.binomial(n, .5, 12000) / n) for n in sizes])
theory = .5 / np.sqrt(sizes)
print("Theory:", theory)
print("Simulation:", empirical.round(4))
assert np.allclose(empirical, theory, rtol=.04)

Output from the lab

Theory: [0.1   0.05  0.025]
Simulation: [0.0994 0.0499 0.025 ]

Practice

  1. How many independent samples reduce the error from 0.05 to 0.01?

Check your reasoning

  1. Five times smaller error needs 25 times the sample size. Starting from 100, use 2,500.

← Week 1 · Subject contents · Week 3 →

Further reading · MIT 18.650 · Statistics for Applications