Estimate · Chapter 4 of 12
Sampling uncertainty and standard errors
Objective: Distinguish sampling uncertainty from bias and choose an uncertainty calculation that matches the design.
What does a narrow confidence interval leave unresolved?
Inference · CLT · Sandwich variance · Clustering
Before you begin: Expectation and variance (chapters 1 and 2), least squares (chapter 3), and square roots. The section on regression standard errors uses matrix notation.
About 30 minutes, plus the exercises.
The sampling process
An estimate is a number from one dataset. A standard error describes how that estimate would vary across repetitions of a specified sampling or assignment process.
That process matters. Repeatedly sampling employees differs from repeatedly randomizing training across the same employees. Sampling 1,000 employees from one office differs from sampling one employee from each of 1,000 independent offices.
A standard-error calculation depends on which quantities are fixed and which are random across repetitions.
A case where the interval is exact
Let be independent draws from a normal population with unknown mean and known standard deviation . Then
Let be the standard normal 97.5th percentile. The interval
contains in 95% of repeated samples. The sampling experiment deliberately uses this known-, Gaussian setting. Its simplicity lets you inspect coverage without mixing in estimated variance or asymptotic approximations.
With , , and , the standard error is . The interval is approximately .
The parameter is fixed in this frequentist calculation; the interval is random before sampling. After observing a particular interval, the procedure’s 95% coverage does not become a 95% posterior probability that lies in that interval. A Bayesian probability statement would require a specified probability model for the unknown parameter.
If is unknown and the observations remain independent normal draws, replacing it with the sample standard deviation yields a Student statistic with degrees of freedom. Using a normal critical value with an estimated standard error is usually an approximation, not that exact result. The Constructions tab of the Distribution Lab builds the distribution draw by draw from a standard normal and an independent chi-square, which shows where its heavier tails come from.
The limits behind large-sample reasoning
For independent, identically distributed observations with , the law of large numbers gives . With finite, positive variance as well, the central limit theorem gives
Convergence in probability concerns closeness to a target. Convergence in distribution concerns the shape of scaled fluctuations. Neither statement says every dataset of size 30, or 300, behaves approximately normally. Heavy tails, rare influential observations, and dependence can make an approximation poor. The lab’s central-limit construction averages draws from skewed and heavy-tailed sources, including a Cauchy source whose average never settles; the normal-errors panel of the OLS assumptions lab checks a regression test under skewed errors.
The same distinction carries into regression. Under suitable sampling and moment conditions, a coefficient becomes increasingly precise around its population projection. That projection can differ from the causal parameter a manager cares about.
Confidence-interval coverage under bias
Suppose the desired target is , but the observations satisfy
The persistent bias is . An analyst mistakenly reports the ordinary mean interval as an interval for . Its actual coverage is
where is the standard normal cumulative distribution function.
Take and . Coverage is about 29.5% at and 0.12% at . With nonzero fixed bias, coverage approaches zero as the sample grows. The interval becomes excellent at locating and terrible at covering .
# Standard Python; 1.96 approximates the exact normal quantile.
from math import erf, sqrt
Phi = lambda z: (1 + erf(z/sqrt(2))) / 2
for n in (25, 100, 400):
bias_in_se = sqrt(n) / 4
coverage = Phi(1.96-bias_in_se) - Phi(-1.96-bias_in_se)
print(n, round(coverage, 4))
Match the standard error to the dependence
Heteroskedasticity allows the error variance to differ across observations. For independent, identically distributed observations, let be the regressor vector and the population projection error. The conditional error variance can still vary with . If the relevant moments exist, is nonsingular, and a suitable central limit theorem applies,
The sample counterpart is the heteroskedasticity-robust sandwich variance estimator. Its job is to estimate sampling variance under unequal variances. It does not correct selection, measurement error, or omitted-variable bias. The constant-variance panel of the OLS assumptions lab shows how far the conventional standard error can understate the spread of a slope when error variance grows with a skewed regressor.
Employees within an office may share shocks. A cluster-robust calculation aggregates score contributions within office:
This displays the uncorrected form; software often adds finite-sample adjustments. The standard justification requires sufficiently many independent clusters and conditions preventing a few clusters from dominating. A large employee count cannot substitute for those conditions. The lab’s independent-errors panel shows the analogous failure for serially correlated errors: the slope stays centered while the conventional standard error understates its spread.
As an illustration for a simple mean with equally sized independent clusters, cluster size and within-cluster correlation inflate variance relative to independent observations by . This formula depends on that exchangeable covariance structure; it is not a universal regression correction.
Exercises
1. How much must sample size increase to halve the standard error of an independent sample mean, keeping population variance fixed?
Work through the solution
The standard error is . Replacing with divides it by two. Doubling multiplies it by . The claim assumes the additional observations follow the same independent sampling process.
2. A training estimate is 3 with a standard error of 0.1. A credible selection mechanism could contribute between 1 and 4 output units to that association. Can the narrow interval establish a positive causal effect?
Work through the solution
No. Ignoring sampling variation for the moment, subtracting the selection contribution gives causal effects between and . Sampling uncertainty would add another layer. Reporting addresses precision around the association and leaves the identification uncertainty unresolved.
Further reading
Hansen’s Econometrics develops asymptotic regression theory. Cameron and Miller’s A Practitioner’s Guide to Cluster-Robust Inference explains why the clustering level and the number of clusters deserve substantive attention.
Write the claim and the assumption doing the most work. Saved only in this browser on this device; avoid sensitive information. Private browsing or clearing site data can erase it.
Notes are optional.
“Explored” records your choice, not a score or a claim of mastery.