01 / 21

Bias, Variance
& MSE

Understanding the bias-variance decomposition of mean squared error: the fundamental tradeoff in statistical estimation.

Statistics

What is an Estimator?

An estimator \(\hat{\theta}\) is a function of the data used to approximate an unknown parameter \(\theta\). Different samples produce different values of \(\hat{\theta}\), giving it a sampling distribution.

Parameter \(\theta\)
The fixed, unknown true value we want to learn.
Estimator \(\hat{\theta}\)
A random variable: a rule applied to a random sample.

Defining Bias

The bias of an estimator measures the systematic error: the difference between the expected value of the estimator and the true parameter value.

Bias tells you whether your estimator is systematically off-target. An unbiased estimator hits the bullseye on average, even if individual estimates miss.

Defining Variance

The variance of an estimator measures how much estimates scatter around their expected value across repeated samples.

A high-variance estimator gives wildly different answers from sample to sample, even if it's unbiased. Variance tells you about consistency, not correctness of the center.

The Bullseye Analogy

Low \(\text{Bias}\)
Low \(\text{Variance}\)
Low \(\text{Bias}\)
High \(\text{Variance}\)
High \(\text{Bias}\)
Low \(\text{Variance}\)
High \(\text{Bias}\)
High \(\text{Variance}\)
Green dot = true value \(\theta\)

Mean Squared Error: MSE

The mean squared error combines both sources of error into a single measure of estimator quality.

MSE penalizes both systematic error (bias) and random scatter (variance). It is always non-negative, and equals zero only for an estimator that always equals \(\theta\) exactly.

The Decomposition Theorem

1
Start: \(E[(\hat{\theta}-\theta)^2]\). Add and subtract \(E[\hat{\theta}]\) inside.
2
Expand: \(E[(\hat{\theta}-E[\hat{\theta}])^2] + 2E[(\hat{\theta}-E[\hat{\theta}])](E[\hat{\theta}]-\theta) + (E[\hat{\theta}]-\theta)^2\)
3
Simplify: The cross term vanishes because \(E[\hat{\theta}-E[\hat{\theta}]]=0\). The result is \(\text{Var}(\hat{\theta}) + [\text{Bias}(\hat{\theta})]^2\).

Visualizing MSE Decomposition

\(\theta\)
\(E[\hat{\theta}]\)
\(\text{Bias}\)
\(\text{Variance}\) spread
\(\text{MSE} = \text{Bias}^2 + \text{Var}\)

Bias vs Variance: Key Distinction

\(\text{Bias}\) \(\text{Variance}\)
Measures Systematic error (accuracy) Random scatter (precision)
Formula \(E[\hat{\theta}] - \theta\) \(E[(\hat{\theta} - E[\hat{\theta}])^2]\)
Can be negative? Yes (can underestimate) No (always \(\geq 0\))
Enters MSE as Squared: \([\text{Bias}(\hat{\theta})]^2\) Directly: \(\text{Var}(\hat{\theta})\)
Reduced by Better model / less restriction More data / regularization

The Tradeoff in Action

Model Complexity Error
\(\text{Bias}^2\)
\(\text{Var}\)
\(\text{MSE}\)
Optimal

How to Compute MSE

1
Identify \(\hat{\theta}\) and \(\theta\): Write down your estimator and the true parameter it targets.
2
Compute \(E[\hat{\theta}]\): Find the expected value of the estimator using the sampling distribution.
3
Compute Bias: \(\text{Bias} = E[\hat{\theta}] - \theta\). If this is zero, the estimator is unbiased.
4
Compute Variance: \(\text{Var}(\hat{\theta}) = E[\hat{\theta}^2] - (E[\hat{\theta}])^2\).
5
Combine: \(\text{MSE} = \text{Bias}^2 + \text{Var}(\hat{\theta})\). Verify by also computing \(E[(\hat{\theta}-\theta)^2]\) directly.

Example 1: Sample Mean

Let \(X_1, \ldots, X_n \overset{\text{iid}}{\sim} (\mu, \sigma^2)\). Consider \(\hat{\mu} = \bar{X} = \frac{1}{n}\sum_{i=1}^n X_i\) as an estimator of \(\mu\).

1
Expected value: \(E[\bar{X}] = \mu\)
2
Bias: \(E[\bar{X}] - \mu = 0\). The sample mean is unbiased.
3
Variance: \(\text{Var}(\bar{X}) = \frac{\sigma^2}{n}\)
4
MSE: \(0^2 + \frac{\sigma^2}{n} = \frac{\sigma^2}{n}\)

Example 2: Biased Variance Estimator

Consider \(\hat{\sigma}^2_{\text{MLE}} = \frac{1}{n}\sum_{i=1}^n(X_i - \bar{X})^2\) as an estimator of \(\sigma^2\) from a normal population.

1
Expected value: \(E[\hat{\sigma}^2_{\text{MLE}}] = \frac{n-1}{n}\,\sigma^2\)
2
Bias: \(\frac{n-1}{n}\sigma^2 - \sigma^2 = -\frac{\sigma^2}{n}\) (systematically underestimates)
3
Variance: \(\text{Var}(\hat{\sigma}^2_{\text{MLE}}) = \frac{2(n-1)}{n^2}\,\sigma^4\)
4
MSE: \(\frac{\sigma^4}{n^2} + \frac{2(n-1)\sigma^4}{n^2} = \frac{(2n-1)\sigma^4}{n^2}\)

Example 3: Comparing Two Estimators

Let \(X_1, \ldots, X_n \overset{\text{iid}}{\sim} \text{Uniform}(0, \theta)\). Compare two estimators of \(\theta\):

\(\hat{\theta}_1 = 2\bar{X}\)
Bias: \(0\)
Var: \(\frac{\theta^2}{3n}\)
MSE: \(\frac{\theta^2}{3n}\)
\(\hat{\theta}_2 = \frac{n+1}{n}X_{(n)}\)
Bias: \(0\)
Var: \(\frac{\theta^2}{n(n+2)}\)
MSE: \(\frac{\theta^2}{n(n+2)}\)

Common Mistakes

✕ Forgetting to Square Bias
\(\text{MSE} = \text{Bias}^2 + \text{Var}\), not \(\text{Bias} + \text{Var}\). The bias enters as its square since MSE is a squared-error measure.
✕ Unbiased = Best
Unbiased does not mean optimal. A biased estimator with much lower variance can have smaller MSE and be preferred.
✕ Confusing \(\text{Var}\) and \(\text{MSE}\)
\(\text{Variance}\) measures spread around \(E[\hat{\theta}]\). \(\text{MSE}\) measures spread around \(\theta\). They're equal only when bias is zero.

Summary at a Glance

Concept Formula Meaning
\(\text{Bias}\) \(E[\hat{\theta}] - \theta\) Systematic error
\(\text{Variance}\) \(E[(\hat{\theta} - E[\hat{\theta}])^2]\) Random scatter
\(\text{MSE}\) \(E[(\hat{\theta} - \theta)^2]\) Total expected error
Decomposition \([\text{Bias}(\hat{\theta})]^2 + \text{Var}(\hat{\theta})\) Tradeoff identity
Unbiased \(\text{MSE}\) \(\text{Var}(\hat{\theta})\) MSE = Var when bias = 0

Question 1 of 5

The bias-variance decomposition states that \(\text{MSE}\) equals:

Question 2 of 5

If \(\hat{\theta}\) is an unbiased estimator of \(\theta\), then its \(\text{MSE}\) equals:

Question 3 of 5

An estimator has \(\text{Bias} = 3\) and \(\text{Var} = 16\). What is its \(\text{MSE}\)?

Question 4 of 5

Estimator A is unbiased with \(\text{Var} = 20\). Estimator B has \(\text{Bias} = 2\) and \(\text{Var} = 10\). Which has lower \(\text{MSE}\)?

Question 5 of 5

The MLE of the population variance divides by \(n\) instead of \(n-1\). This estimator is: