Day 8. Estimators: Bias, Variance, MSE & Consistency
How to judge an estimator, and why "unbiased" is not the same as "good".
- ●Compute the bias, variance and mean squared error (MSE) of an estimator.
- ●Prove the bias–variance decomposition and that the n − 1 sample variance is unbiased.
- ●Distinguish unbiasedness from consistency and show when MSE → 0 implies consistency.
- ●Combine independent estimates with inverse-variance weights.
Theory
Estimands, estimators, estimates
- The estimand is the quantity you want (the ATE, a population mean).
- An estimator is a rule that turns data into a number. Because data are random, is a random variable with a sampling distribution.
- An estimate is the number you get from your particular sample.
Three criteria
A slightly biased estimator with much lower variance can have lower MSE: this bias–variance trade-off is behind shrinkage, ridge regression and machine-learning nuisance models (Phase 6).
Consistency
is consistent if . A sufficient condition is . Consistent estimators can be biased in finite samples (e.g. ); unbiased estimators can be inconsistent (e.g. using only the first observation).
Most estimators in causal inference are -consistent and asymptotically normal:
so their standard error is approximately .
The sample variance
The plug-in variance is biased downward; the sample variance is unbiased. The "lost" degree of freedom is the one used to estimate .
Causal link. A biased estimator does not improve with more data: a confounded comparison converges to the wrong number. Identification (is the estimand recoverable at all?) comes before estimation (how precisely?).
Part 1 · Warm-up
Exercise 1 · Two unbiased estimators
From iid data with mean and variance , compare and .
Show solution
Step 1. Both are unbiased: .
Step 2. But while .
Step 3. For , is more precise; throws data away.
Exercise 2 · MSE arithmetic
An estimator has bias 2 and variance 5. What is its MSE and root-MSE?
Show solution
, root-MSE .
Exercise 3 · A shrinkage estimator
Let with , and . Compute its MSE when and when , and compare with .
Show solution
Step 1. Bias of : . Variance: .
Step 2. For itself: bias 0, variance , so MSE .
Step 3. If : bias , MSE .
Step 4. If : bias , MSE .
Answer: shrinking toward zero helps when the truth is near zero (MSE 3.28 versus 4) and hurts when it is far away (4.24 versus 4).
Exercise 4 · The plug-in variance
For and , what is for the plug-in (divide-by-) variance?
Show solution
: a bias of (Exercise 7 proves this).
Exercise 5 · Biased but consistent
Is unbiased? Consistent?
Show solution
Biased: . Consistent: bias and variance , so the MSE .
Part 2 · Proofs
Exercise 6 · Bias–variance decomposition
Prove .
Show solution
Add and subtract :
This is the same algebra as Day 3, Exercise 10.
Exercise 7 · Why divide by n − 1
Prove for iid data.
Show solution
Use (expand ; the cross term sums to zero). Taking expectations:
Exercise 8 · MSE → 0 implies consistency
Prove that if then .
Show solution
Apply Markov's inequality to :
Exercise 9 · The sample mean is the best linear unbiased estimator
Among estimators with (so they are unbiased), show that equal weights minimise the variance.
Show solution
Step 1. The variance is .
Step 2. Write with .
Step 3. Then
Step 4. with equality only when all .
Exercise 10 · The best shrinkage factor
For , find the that minimises the MSE.
Show solution
Step 1. .
Step 2. Setting the derivative to zero, , gives
Step 3. It depends on the unknown , which is why practical shrinkage (empirical Bayes, Day 13) estimates it from the data.
Part 3 · Applied
Exercise 11 · The difference in means is unbiased in a cash-transfer RCT
Households are randomly assigned to receive a cash transfer () or not, independently of their potential consumption levels . Show that the difference between the treated and control groups' mean consumption, , is unbiased for the ATE.
Show solution
Step 1. In the treated group each observed , so .
Step 2. Random assignment gives (Day 6, Exercise 14).
Step 3. Likewise .
Step 4. Linearity: .
Exercise 12 · Pooling two evaluations
Two independent RCTs of the same school-meals programme estimate its effect on attendance as 2.0 days (SE 0.5) and 3.0 days (SE 1.0). Find the inverse-variance weighted estimate and its standard error.
Show solution
Step 1. Weights are inverse variances: and .
Step 2. Pooled estimate:
Step 3. Variance of the pooled estimate: , so .
Answer: 2.2 days (SE 0.45), more precise than either study alone. This is fixed-effect meta-analysis.
Exercise 13 · More data does not cure confounding
In Day 4's confounded DGP the naive difference converges to 17 while the true effect is 5. Is the naive estimator consistent for the ATE?
Show solution
Step 1. The naive difference converges to its own probability limit, .
Step 2. Its bias for the ATE is at every sample size.
Step 3. Its variance shrinks to zero, so its MSE tends to , not zero.
Answer: not consistent for the ATE. More data gives an ever more precise estimate of the wrong number.
Exercise 14 · Mean or median test score?
A ministry summarises the test scores of 100 pupils per school. Scores are roughly normal with . The sample median has variance about . Compare its precision with the sample mean's, and say when the median might be preferred.
Show solution
Step 1. Variance of the mean: .
Step 2. Variance of the median: .
Step 3. Relative efficiency: ; the median needs about 57% more pupils for the same precision.
Answer: with normal scores the mean is more precise. With heavy tails or data errors (e.g. a few mis-coded scores of 0) the median can win; try the t-distribution in the Lab.
Exercise 15 · Planning a consumption survey
An unbiased estimator of mean monthly household consumption (in $100) has variance . How many households are needed for its MSE to be below 0.01, i.e. a root-MSE below $10?
Show solution
Step 1. Unbiased, so MSE = variance = .
Step 2. Require , i.e. .
Answer: more than 400 households.
Verify in Python
import numpy as np
rng = np.random.default_rng(8)
reps, n, sigma = 100_000, 25, 10
for mu in (10, 2):
xbar = rng.normal(mu, sigma, (reps, n)).mean(1)
for name, est in (("mean", xbar), ("0.9*mean", 0.9 * xbar)):
print(f"mu={mu:>2} {name:>8}: bias {est.mean() - mu:+.3f} MSE {((est - mu)**2).mean():.3f}")
# The n vs n-1 variance
x = rng.normal(0, np.sqrt(50), (100_000, 10))
print("E[plug-in var] ~", x.var(axis=1, ddof=0).mean().round(2), "; E[s^2] ~", x.var(axis=1, ddof=1).mean().round(2))
# Mean vs median efficiency with normal data
x = rng.normal(0, 10, (50_000, 100))
print("Var(mean) ~", x.mean(1).var().round(3), " Var(median) ~", np.median(x, 1).var().round(3))
Key takeaways
- MSE = variance + bias²: judge estimators on both.
- Consistency is about the limit, unbiasedness about the average: neither implies the other.
- No sample size fixes a biased (unidentified) comparison.
Simulation Lab: Estimator Race: Bias, Variance & MSE
Open full screen →Mean, median and a shrinkage estimator compete across repeated samples.
| estimator | bias | variance | MSE |
|---|---|---|---|
| Sample mean | 0.048 | 3.847 | 3.849 |
| Sample median | 0.050 | 6.027 | 6.029 |
| 0.90 × mean | -0.156 | 3.116 | 3.141 |
3,000 repeated samples per setting. With normal data the mean wins among unbiased estimators; with heavy tails (t₃) the median can beat it. Shrinkage wins when the truth is near zero.