From STA238 Probability Statistics and Data Analysis II

Judging an estimator

1. The question

You ran maximum likelihood or method of moments and got a formula. Is it any good?

Two things can be wrong with it, and they’re tracked separately:

  • Bias. Across all the samples you could have drawn, does it centre on the parameter?
  • Variance. How much do those answers scatter?

Both are properties of the recipe, not of the sample you happen to hold. A perfect sample run through a biased recipe still gives a biased answer.

2. Bias

bias(θ^)=E[θ^]θ\text{bias}(\hat\theta) = \mathbb{E}[\hat\theta] - \theta

Take the expectation of your estimator, subtract the true parameter, see what’s left. Zero means unbiased. Anything else is the bias, and it’s usually an expression in θ\theta and nn rather than a number.

2.1 How you actually compute it

It’s algebra, not simulation. Nobody ran experiments to find these; they’re derived once on paper and exact for every nn.

Two tools carry the linear cases:

  • Linearity of expectation. E[aX+bY]=aE[X]+bE[Y]\mathbb{E}[aX + bY] = a\mathbb{E}[X] + b\mathbb{E}[Y], independent or not.
  • What the family gives you.X1,,XnX_1, \dots, X_n iid with mean μ\mumeans E[Xi]=μ\mathbb{E}[X_i] = \mu. That’s the assumption, and it’s where μ\mu enters the algebra.

The sample mean, worked:

E[Xˉ]=E ⁣[X1++Xnn]=1n(E[X1]++E[Xn])=nμn=μ\mathbb{E}[\bar{X}] = \mathbb{E}\!\left[\frac{X_1 + \dots + X_n}{n}\right] = \frac{1}{n}\left(\mathbb{E}[X_1] + \dots + \mathbb{E}[X_n]\right) = \frac{n\mu}{n} = \mu

Comes out as μ\mu, the same symbol as the truth, so the bias is μμ=0\mu - \mu = 0.

No number was ever computed. The truth stayed a letter and cancelled. That’s what makes the result stronger than knowing μ\mu would be: it holds for every possible μ\mu at once.

2.2 Aug 2023 Q2a, worked

μ^=rXˉn+(1r)Yˉm\hat\mu = r\bar{X}_n + (1-r)\bar{Y}_m. Is μ^\hat\mu unbiased for μ\mu? [2 marks]

E[μ^]=rE[Xˉn]+(1r)E[Yˉm]=rμ+(1r)μ=μ(r+1r)=μ\mathbb{E}[\hat\mu] = r\,\mathbb{E}[\bar{X}_n] + (1-r)\,\mathbb{E}[\bar{Y}_m] = r\mu + (1-r)\mu = \mu(r + 1 - r) = \mu

Unbiased. Three lines, two marks, and the whole thing is linearity plus E[Xˉ]=μ\mathbb{E}[\bar{X}] = \mu.

2.3 When the estimator isn’t linear

maxixi\max_i x_i and 1/xˉ1/\bar{x} can’t be handled by pushing expectation through, because expectation doesn’t commute with max or with reciprocal. Then you need the distribution of the estimator itself and an integral.

Papers know this is harder and supply what you need. Apr 2024 Q3b hands you the Gamma density explicitly so you can compute E[1/Yˉ]\mathbb{E}[1/\bar{Y}].

3. Why maximum likelihood can be biased

The apparent contradiction: MLE optimizes over the parameter, so how can it systematically miss?

Because MLE and bias answer different questions.

  • MLE asks: given the one sample I have, which θ\theta makes this data most probable?
  • Bias asks: if I ran this recipe on every possible sample, where would the answers centre?

MLE never looks at the samples you didn’t draw. It can’t, it only has one. So there’s no contradiction in it being biased; it’s answering its own question correctly, and that question isn’t about averages.

3.1 Where the bias comes from

Three shapes of parameter, and only one is free:

  • Parameter is a centre → the MLE lands on the sample’s centre → unbiased. A sample’s centre is an unbiased estimate of the population’s centre.
  • Parameter is an edge → the MLE lands on the sample’s edge → biased inward. The largest of nn draws is always inside the true endpoint, because you’d have to draw the endpoint exactly to reach it.
  • Parameter is a spread → biased low, because the spread gets measured around xˉ\bar{x} rather than around μ\mu.

3.2 The Uniform maximum, and where n/(n+1) comes from

Unif(0,θ)\text{Unif}(0,\theta), MLE is maxixi\max_i x_i. No draw can exceed θ\theta, so the max can’t either, and it almost certainly falls short.

By how much: nn draws mark nn points on the interval, and nn points cut it into n+1n+1 segments. Since the draws are uniform, no position is special, so every segment has the same expected length by symmetry. The gap above your largest draw is one of those n+1n+1 segments.

E[maxiXi]=θnn+1\mathbb{E}[\max_i X_i] = \theta \cdot \frac{n}{n+1}

With n=5n = 5 the max reads about 83% of θ\theta. Bias is θ/(n+1)-\theta/(n+1).

The bias shrinks with nn and is never zero at finite nn. That’s asymptotic unbiasedness, which maximum likelihood has in general.

3.3 Sample size helps, sample quality doesn’t

Worth separating, because they’re different claims.

A perfectly representative sample doesn’t help. Five evenly spaced draws from Unif(0,100)\text{Unif}(0,100) land at 16.7, 33.3, 50, 66.7, 83.3. The max is 83.3 and the truth is 100. Nothing about that sample being good rescues it. The recipe reads low.

A bigger sample does help. n=500n = 500 gives 99.8% of θ\theta instead of 83%. More draws crowd closer to the endpoint.

So bias isn’t bad luck in the draw. It’s the recipe, and its size depends on nn.

3.4 Why the MLE for variance is biased

σ^2=1ni(xixˉ)2\hat\sigma^2 = \frac{1}{n}\sum_i (x_i - \bar{x})^2 reads low, every sample, in the same direction.

The reason is one substitution: you measured spread around xˉ\bar{x} instead of around μ\mu. And xˉ\bar{x} is by definition the point that minimizes the sum of squared distances to your data. So measuring from anywhere else, including from the true μ\mu, gives a bigger number.

You’re comparing against the minimum, so you can only come out low.

Numbers. Truth is μ=170\mu = 170; your five heights are 165, 168, 172, 174, 176, so xˉ=171\bar{x} = 171:

Centre usedSquared distancesAverage
xˉ=171\bar{x} = 17136, 9, 1, 9, 2516
true μ=170\mu = 17025, 4, 4, 16, 3617
17249, 16, 0, 4, 1617

Every alternative centre gives more. Not because those numbers are special, because 171 is the minimizer for that data.

And it reads low whichever way the sample is shifted. A sample of tall people has xˉ\bar{x} too high, a sample of short people has it too low, and both produce a spread that is too small. Errors in μ\mu have signs and cancel; the resulting errors in σ2\sigma^2 do not.

The correction is (n1)(n-1) in the denominator instead of nn, which is why every stats package uses it.

4. The per-family table

Bias is a fact about a pair: the family and the recipe. Method of moments on the same family has a different bias than maximum likelihood does. So it’s a lookup, the same way the density and the moment formula are lookups.

FamilyParameterMLEBiased?Correction
N(μ,σ2)\mathcal{N}(\mu,\sigma^2)μ\muxˉ\bar{x}no
N(μ,σ2)\mathcal{N}(\mu,\sigma^2)σ2\sigma^21n(xixˉ)2\frac{1}{n}\sum(x_i-\bar{x})^2low by n1n\frac{n-1}{n}divide by n1n-1
Unif(0,θ)\text{Unif}(0,\theta)θ\thetamaxixi\max_i x_ilow by nn+1\frac{n}{n+1}×n+1n\times \frac{n+1}{n}
Exp(λ)\text{Exp}(\lambda)λ\lambda1/xˉ1/\bar{x}yesrarely asked
Pois(λ)\text{Pois}(\lambda)λ\lambdaxˉ\bar{x}no

The corrected Uniform estimator θ^=n+1nmn\hat\theta = \frac{n+1}{n} m_n is the one on Aug 2023 Q4.

Method of moments is unbiased when the parameter is a linear function of the moment, and biased otherwise. Unif(0,θ)\text{Unif}(0,\theta) has θ=2E[X]\theta = 2\mathbb{E}[X], linear, so 2xˉ2\bar{x} is unbiased. Exp(λ)\text{Exp}(\lambda) has λ=1/E[X]\lambda = 1/\mathbb{E}[X], curved, so 1/xˉ1/\bar{x} is biased. Same Jensen reason that E[T]E[T]\mathbb{E}[\sqrt{T}] \ne \sqrt{\mathbb{E}[T]}.

5. The workflow

The course teaches estimation and bias as two units, which makes them look disconnected. They’re one loop:

  1. Estimate. Run maximum likelihood or method of moments, get a formula.
  2. Check. Compute E[θ^]\mathbb{E}[\hat\theta] and see whether θ\theta cancels.
  3. Correct, if it doesn’t and correcting is worth it.

Nobody ships the raw Uniform max or the 1/n1/n variance. The corrected versions are what get used, and step 2 is how you find them.

Step 3 says “if it’s worth it” because removing bias can raise variance. The raw max is biased and tight; 2xˉ2\bar{x} is unbiased and noisy. Which is better depends on both, which is what mean squared error is for.

6. The sampling distribution

Before you draw the sample, θ^\hat\theta is random, because the sample is. So it has a distribution of its own: a centre, a spread, a shape. That’s the sampling distribution, and bias and variance are just descriptions of it.

The cleanest way to hold it: an estimator is a transformation from the family to a new distribution.

Xˉ turns N(μ,σ2) into N(μ,σ2/n)\bar{X} \ \text{turns}\ \mathcal{N}(\mu, \sigma^2)\ \text{into}\ \mathcal{N}(\mu, \sigma^2/n)

Same centre, narrower by a factor of nn. Which is exactly why more data helps and why the centre never moves. Similarly maxiXi\max_i X_i turns Unif(0,θ)\text{Unif}(0,\theta) into something centred at θnn+1\theta \cdot \frac{n}{n+1}, which is the bias.

Two levels, and confusing them is a real error:

  • the data has a distribution, the family, with variance σ2\sigma^2
  • the estimator has a distribution, narrower, with variance σ2/n\sigma^2/n

Sometimes the output distribution has a name. The sum of nn exponentials is Gamma(n,λ)\text{Gamma}(n,\lambda), which is what Apr 2024 Q3b hands you so you can integrate against it. Sometimes it doesn’t, and you only compute its mean and variance. For large nn the central limit theorem says the sample mean’s distribution is approximately normal whatever the family, which is what makes confidence intervals possible.

7. Variance

Var(θ^)=E[(θ^E[θ^])2]=E[θ^2](E[θ^])2\text{Var}(\hat\theta) = \mathbb{E}\big[(\hat\theta - \mathbb{E}[\hat\theta])^2\big] = \mathbb{E}[\hat\theta^2] - \big(\mathbb{E}[\hat\theta]\big)^2

The expected squared distance from the estimator’s own mean. Squared so deviations in both directions count as spread instead of cancelling. The second form is the one you compute with, since E[θ^2]\mathbb{E}[\hat\theta^2] is usually easier to get than the definition.

θ\theta does not appear. Variance is scatter around wherever the estimator centres, right or wrong. Putting θ\theta in place of E[θ^]\mathbb{E}[\hat\theta] gives you mean squared error instead, which is the same shape measured from the truth. The three, side by side:

Measured fromFormula
Biasthe truthE[θ^]θ\mathbb{E}[\hat\theta] - \theta
Varianceits own centreE[(θ^E[θ^])2]\mathbb{E}[(\hat\theta - \mathbb{E}[\hat\theta])^2]
MSEthe truth, squaredE[(θ^θ)2]\mathbb{E}[(\hat\theta - \theta)^2]

7.1 Every estimator has its own variance

Exactly parallel to bias: it’s a per-estimator fact, derived once and then looked up.

EstimatorBiasVariance
xˉ\bar{x} for μ\mu0σ2/n\sigma^2/n
maxixi\max_i x_i for θ\thetaθ/(n+1)-\theta/(n+1)θ2n/((n+1)2(n+2))\theta^2 n / ((n+1)^2(n+2))
X1X_1 for μ\mu0σ2\sigma^2

Var(xˉ)=σ2/n\text{Var}(\bar{x}) = \sigma^2/n is the one worth memorising, because the sample mean is what confidence-interval questions use. The formula is the same for every family; what changes is the number you substitute for σ2\sigma^2, and that’s on the formula sheet: 1/λ21/\lambda^2 for Exp(λ)\text{Exp}(\lambda), (ba)2/12(b-a)^2/12 for Unif(a,b)\text{Unif}(a,b), λ\lambda for Pois(λ)\text{Pois}(\lambda).

Two different variances, and they get confused. σ2\sigma^2 is how spread out the data is, a fact about the world that doesn’t change with nn. Var(xˉ)\text{Var}(\bar{x}) is how spread out your answer is, a fact about your procedure that shrinks with nn:

nnσ2\sigma^2Var(xˉ)\text{Var}(\bar{x})
1100100
410025
1001001

Its square root, σ/n\sigma/\sqrt{n}, is the standard error, and it’s what appears in every confidence interval.

The one that carries most questions:

Var(Xˉ)=σ2n\text{Var}(\bar{X}) = \frac{\sigma^2}{n}

Two rules for the algebra:

Var(aX)=a2Var(X)Var(X+Y)=Var(X)+Var(Y)\text{Var}(aX) = a^2\,\text{Var}(X) \qquad \text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)

Constants come out squared. And the sum rule requires XX and YY to be independent, unlike linearity of expectation which never needs it. So bias calculations survive dependence and variance calculations don’t, which is why the questions state “independent samples” explicitly.

7.1 Unbiased and useless

An estimator can aim perfectly and still be worthless. “Use only the first observation” is unbiased for μ\mu, since a single draw has expectation μ\mu. Its variance is σ2\sigma^2 rather than σ2/n\sigma^2/n, so it scatters nn times as widely as the sample mean.

Right aim, terrible precision. Which is why neither number decides alone.

8. Efficiency and mean squared error

Efficiency compares two unbiased estimators: the one with smaller variance is more efficient. When a question gives you a family of unbiased estimators indexed by some constant and asks for the best one, it’s asking you to minimize the variance over that constant.

Aug 2023 Q2b is exactly this: μ^=rXˉn+(1r)Yˉm\hat\mu = r\bar{X}_n + (1-r)\bar{Y}_m, all unbiased for any rr by part (a), and “for what value of rr is μ^\hat\mu most efficient?” is 8 marks of writing down Var(μ^)\text{Var}(\hat\mu) in terms of rr and differentiating.

8.1 The Cramér-Rao bound

Efficiency compares the estimators you happen to have. The Cramér-Rao bound says how good any unbiased estimator could possibly be: for a given family and nn, there’s a floor below which no unbiased estimator’s variance can go.

Var(θ^)  1nI(θ)\text{Var}(\hat\theta) \ \ge\ \frac{1}{n I(\theta)}

where I(θ)I(\theta) is the Fisher information, a measure of how sharply the likelihood distinguishes nearby values of θ\theta. A sharply peaked likelihood means the data pins the parameter down well, so the floor is low.

An unbiased estimator that achieves the bound is efficient, and nothing unbiased beats it.

Not on any of the three past finals. Know what it claims and don’t spend an hour on it.

Mean squared error is the referee when bias and variance trade against each other:

MSE(θ^)=E[(θ^θ)2]=bias2+variance\text{MSE}(\hat\theta) = \mathbb{E}\big[(\hat\theta - \theta)^2\big] = \text{bias}^2 + \text{variance}

One number for total badness. It’s what lets you compare a biased tight estimator against an unbiased noisy one. On Unif(0,θ)\text{Unif}(0,\theta): maxixi\max_i x_i is biased with low variance, 2xˉ2\bar{x} is unbiased with high variance, and MSE decides.

Which is also why step 3 of the workflow says “correct it if it’s worth it.” Removing bias can raise variance enough to make the total worse.

9. Consistency

The same question asked in the limit: as the sample size grows, do the bias and the variance both shrink to zero? Equivalently, does MSE0\text{MSE} \to 0 as nn \to \infty.

So consistency isn’t a seventh idea. It’s MSE again, evaluated at infinity instead of at your actual nn.

Biased and consistent is the common case, and it’s where most maximum likelihood estimators live. The Uniform max has bias θ/(n+1)-\theta/(n+1):

nnbias as a fraction of θ\theta
517%
10000.1%
10610^60.0001%

Nonzero at every finite nn, approaching zero. The same way 1/n1/n is never zero and its limit is.

All four combinations exist:

ConsistentNot consistent
Unbiasedxˉ\bar{x}”use only X1X_1” — unbiased, never settles
Biasedmaxixi\max_i x_i”always answer 7” — bias is 7θ7 - \theta, no nn in it

The bottom right is the case worth noticing. Nothing requires nn to appear in a bias term, so an estimator can be biased by a fixed amount forever and no quantity of data helps.

Two things consistency does not tell you. It’s a statement about the limit, so it says nothing about how bad things are at the nn you have. An estimator that only becomes reasonable at n=109n = 10^9 is consistent and useless with 25 observations. And nearly everything sensible is consistent, so passing the test rules out disasters rather than identifying good estimators.

The one direction that is airtight: if the bias grows with nn, it cannot converge to zero, so the estimator is not consistent.