Foundations to Frontier
Tests
A. Mathematical Foundations › A5 Statistics › Descriptive and inferential statistics

Sampling Distributions and Standard Error

A statistic computed from a random sample is itself random. Its distribution across repeated samples, the sampling distribution, tells you how much to trust it, and its standard deviation is the standard error. You will derive SE = σ/√n for the mean, meet the χ² and Student-t distributions that govern sample variances and studentized means, compare the mean with the median, and learn the two traps of engineering simulation: tail quantiles need far more runs than means, and correlated samples make naive standard errors far too small (batch means fixes it).

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

If you asked again, would you get the same answer?

You test a robot on 10 grasps and it succeeds 8 times: 80%. Test it again on another 10 and you might get 7, or 9. The number you computed depends on which trials you happened to get. If you imagine repeating the whole experiment many times, the answers form a spread-out pile. That pile is the sampling distribution, and its width, the standard error, tells you how much your 80% could be off.

Bigger samples give narrower piles. Four times as many trials roughly halves the wobble.

Draw many samples: how much does the statistic wobble?
population:
statistic:
mean over 3000 samples of size 10: average 2.005 · standard error 0.641 (σ/√n = 0.632) · skewness 0.64
Blue: the sampling distribution of the chosen statistic. Orange: a normal curve with the same mean and SE, for comparison. The mean's SE is σ/√n for any population, and its distribution becomes normal as n grows, even for the skewed exponential or the bimodal mixture. The max is skewed and its SE shrinks slowly. The median of the bimodal population jumps between the modes at small n.
Why engineers care

Every number reported from tests or simulations (success rates, mean errors, worst-case percentiles) should come with a standard error. Without one, you can’t tell a real improvement from luck, or know whether you ran enough simulations.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Repeating an experiment gives slightly different answers because…
  2. 2. To halve the wobble of an average you need about…
  3. 3. The spread of a statistic across repeated samples is called its…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The standard error of the mean

For iid samples with standard deviation σ\sigma,

SE⁡(Xˉ)=σn,SE⁡^=sn\operatorname{SE}(\bar X) = \frac{\sigma}{\sqrt n}, \qquad \widehat{\operatorname{SE}} = \frac s{\sqrt n}

and by the CLT, Xˉ≈N(μ,σ2/n)\bar X\approx\mathcal N(\mu, \sigma^2/n) for moderate nn (A4.3-5).

  • Proportions: SE⁡(p^)=p(1−p)/n\operatorname{SE}(\hat p) = \sqrt{p(1-p)/n}. For 360 successes in 400 trials, p^=0.90±0.015\hat p = 0.90\pm0.015.
  • Report both: the estimate and its SE, for example “0.90 (SE 0.015)”, or a confidence interval (A5.1-6).

Other statistics have sampling distributions too

The median, the sd, a regression slope and the maximum each have a sampling distribution with its own SE. For normal data, the median’s SE is about 1.2533 σ/n1.2533\,\sigma/\sqrt n: noisier than the mean’s.

📝 Quick check (Level 1)
0/3 answered
  1. 1. s = 12, n = 36: SE of the mean?
  2. 2. SE of a proportion p̂ = 0.5 with n = 100?
  3. 3. For normal data, which has the smaller SE?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

Exact sampling distributions for normal data

If Xi∼N(μ,σ2)X_i\sim\mathcal N(\mu, \sigma^2) iid:

  1. Xˉ∼N(μ,σ2/n)\bar X\sim\mathcal N(\mu, \sigma^2/n) exactly.
  2. (n−1)s2/σ2∼χn−12(n - 1)s^2/\sigma^2\sim\chi^2_{n-1}, with mean n−1n - 1 and variance 2(n−1)2(n - 1).
  3. Xˉ\bar X and s2s^2 are independent. This property characterizes the normal distribution.
  4. Therefore T=Xˉ−μs/n∼tn−1T = \frac{\bar X - \mu}{s/\sqrt n}\sim t_{n-1}, Student’s t. It has heavier tails than N(0,1)\mathcal N(0,1) because ss is itself noisy. With n=5n = 5, ∣T∣>1.96\lvert T\rvert > 1.96 about 12% of the time, not 5% (Gosset, writing as “Student”, 1908).

Quantiles are expensive

The sample pp-quantile has SE⁡≈p(1−p)/nf(qp)\operatorname{SE}\approx\frac{\sqrt{p(1-p)/n}}{f(q_p)}. In the tails, the density f(qp)f(q_p) is tiny, so the SE is large. Estimating the 99th-percentile landing miss of a vehicle to ±10 m can need over 20,000 Monte Carlo runs, where the mean needs a few hundred (Exercise 2).

Correlated samples

For a stationary series with autocorrelations ρk\rho_k, Var⁡Xˉ≈σ2n(1+2∑kρk)\operatorname{Var}\bar X\approx\frac{\sigma^2}n(1 + 2\sum_k\rho_k). For AR(1) with ϕ=0.9\phi = 0.9, that inflates the variance about 19× (the SE about 4.4×). Batch means: split the series into contiguous batches, average each batch, and use the spread of the batch means.

🐍 Exercise 1: simulating sampling distributions
Simulate the sampling distributions of the mean, the median and the scaled sample variance for normal data. Check SE = σ/√n, the median's 1.2533σ/√n, the χ²(n − 1) moments, and that a small-n t-statistic exceeds 1.96 far more than 5% of the time.
📝 Quick check (Level 2)
0/3 answered
  1. 1. (n − 1)s²/σ² for normal data follows…
  2. 2. Using s instead of σ makes the standardized mean follow…
  3. 3. Positive autocorrelation makes the naive SE…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Proof that x̄ and s² are independent (normal data)

Let QQ be an orthogonal matrix whose first row is 1⊤/n\mathbf 1^\top/\sqrt n, and set Y=QXY = QX.

  1. Rotation. The vector X−μ1X - \mu\mathbf 1 is isotropic Gaussian, so Y1,…,YnY_1, \dots, Y_n are independent normals, all with variance σ2\sigma^2.
  2. The mean is one coordinate. Y1=nXˉY_1 = \sqrt n\bar X.
  3. The rest give the variance. ∑i≥2Yi2=∥Y∥2−Y12=∑Xi2−nXˉ2=(n−1)s2\sum_{i\ge2}Y_i^2 = \lVert Y\rVert^2 - Y_1^2 = \sum X_i^2 - n\bar X^2 = (n - 1)s^2.
  4. Conclude. Xˉ\bar X depends only on Y1Y_1 and s2s^2 only on Y2,…,YnY_2, \dots, Y_n, so they’re independent. Also (n−1)s2/σ2(n - 1)s^2/\sigma^2 is a sum of n−1n - 1 squared standard normals: χn−12\chi^2_{n-1}. ∎

Why n − 1?

E∑(Xi−Xˉ)2=∑E(Xi−μ)2−nE(Xˉ−μ)2=nσ2−σ2=(n−1)σ2\mathbb E\sum(X_i - \bar X)^2 = \sum\mathbb E(X_i - \mu)^2 - n\mathbb E(\bar X - \mu)^2 = n\sigma^2 - \sigma^2 = (n - 1)\sigma^2. Estimating μ\mu uses up one degree of freedom (A5.1-3).

The quantile SE

q^p≤x\hat q_p\le x iff at least npnp samples are ≤x\le x. That count is binomial, with variance nF(x)(1−F(x))nF(x)(1 - F(x)). Linearizing FF near qpq_p converts a spread of p(1−p)/n\sqrt{p(1-p)/n} in probability into p(1−p)/n/f(qp)\sqrt{p(1-p)/n}/f(q_p) in xx: the Bahadur representation.

Exercise 3.1: Derive the median’s SE for normal data

Take p=1/2p = 1/2 and f(μ)=1/(σ2π)f(\mu) = 1/(\sigma\sqrt{2\pi}): SE⁡=1/(4n)1/(σ2π)=σπ2n≈1.2533σn\operatorname{SE} = \frac{\sqrt{1/(4n)}}{1/(\sigma\sqrt{2\pi})} = \sigma\sqrt{\frac{\pi}{2n}}\approx1.2533\frac\sigma{\sqrt n}.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The independence of x̄ and s² is proved by…
  2. 2. The quantile SE is large in the tails because…
  3. 3. E Σ(Xᵢ − X̄)² =

Level 4: Expert

★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.

How many Monte Carlo runs? Tails and correlation

Monte Carlo dispersion analyses for entry, descent and landing report means and tail percentiles of quantities like the landing miss, peak heating and fuel left. Tail percentiles need many more runs. The SE formula above says how many, and order-statistic arguments give distribution-free bounds: with 59 runs, the largest has a 95% chance of exceeding the 95th percentile, and with 299 runs, the 99th (Wilks, 1941). Correlated outputs, such as MCMC chains, long simulations sampled finely, or sensor logs, need batch-means or spectral standard errors, or the uncertainty is badly understated.

🐍 Exercise 2 (research): SE of a 99th-percentile miss, and batch means
Check the quantile SE formula for the 99th percentile of a simulated landing miss from 2000 runs, and compute how many runs give ±10 m. Then generate an AR(1) series with φ = 0.9 and show that the naive SE is about 4× too small, while batch means recovers the true SE.

Sampling distributions in AI, robotics and aerospace

  • Benchmark claims. Mean returns over 5 seeds have large SEs. Many reported RL “improvements” disappear once you compute them (Henderson et al., 2018).
  • Wilks’ formula sets run counts for nuclear-safety and aerospace dispersion analyses in a distribution-free way (Wilks, 1941; NASA-STD-7009).
  • MCMC output uses effective sample size and batch-means or spectral SEs (Flegal and Jones, 2010; Vehtari et al., 2021 for R-hat and ESS).
  • SGD noise is the sampling distribution of a minibatch gradient, with SE ∝1/B\propto1/\sqrt B (A4.3-5).
  • Sensor calibration reports the bias with an SE from repeated measurements. Autocorrelated noise, such as gyro bias drift, needs Allan-variance-style analysis instead (A4.4-2).

References

  1. “Student” (W. S. Gosset) (1908). “The probable error of a mean.” Biometrika, 6(1).
  2. R. A. Fisher (1925). Statistical Methods for Research Workers. Oliver & Boyd.
  3. G. Casella, R. Berger (2002). Statistical Inference, 2nd ed., Ch. 5. Duxbury.
  4. S. Wilks (1941). “Determination of sample sizes for setting tolerance limits.” Annals of Mathematical Statistics, 12(1).
  5. R. Bahadur (1966). “A note on quantiles in large samples.” Annals of Mathematical Statistics, 37(3).
  6. J. Flegal, G. Jones (2010). “Batch means and spectral variance estimators in Markov chain Monte Carlo.” Annals of Statistics, 38(2).
  7. A. Vehtari, A. Gelman, D. Simpson, B. Carpenter, P.-C. Bürkner (2021). “Rank-normalization, folding, and localization: an improved R-hat.” Bayesian Analysis, 16(2).
  8. P. Henderson et al. (2018). “Deep reinforcement learning that matters.” AAAI.
  9. NASA (2016). NASA-STD-7009A: Standard for Models and Simulations.
  10. A. van der Vaart (1998). Asymptotic Statistics, Ch. 21 (quantiles). Cambridge University Press.