Properties of estimators — step-by-step proofs of bias, MSE, the uniform’s maximum, Cramér–Rao and consistency (and the squared error smaller than the variance)
In a class mock exam I was asked for the mean squared error of the maximum of a uniform, and I got one smaller than its variance. I had written instead of , and since the bias of the maximum is negative, adding it made the total error go down. The lecturer did not cross out the working: he just wrote next to it “a mean error smaller than the scatter?”. Nothing more was needed. An MSE can never be smaller than the variance, because what you add to it is a square. Since then, I check every result in this topic with a question like that before accepting it.
In the properties of estimators theory we saw what bias, MSE, the Cramér–Rao bound and consistency are, and we checked them by simulation with the rental scooter fleet in Las Palmas. Here is why each result is true, step by step, with no jumps. These are the proofs that come up in the EC2: proving that an estimator is unbiased, computing its MSE, comparing two of them, seeing whether one reaches the bound and whether it is consistent. After each one, “Check it with R” tests it against numbers.
Table of Contents
Before you start: the rules we will use
Every step of the proofs is justified by one of these rules. I quote them by number (“by rule 3”).
- Linearity of expectation: and , independent or not.
- Variance of transformations and sums: and, if the are independent, . Together they give .
- The second moment: , so .
- Independence: if are independent, .
- Expectation of a function: (or if X is discrete).
- The chi-squared of the variance: in a normal population, , and a has mean k and variance 2k (we saw it in sampling distributions).
- Gamma: the sum of n independent exponential(λ) variables is a gamma(n, λ), with density , and . Also .
- Consistency theorem: if and , then is consistent.
Proof 1: S² is unbiased and S’² is not (though it is asymptotically unbiased)
What we want to prove
In any population with mean μ and variance σ² (it does not have to be normal):
Why it matters. It is the reason R’s var() and sd() divide by n − 1, and why “an unbiased estimator of σ²” is and not . And the technique (open up the square and use rule 3) comes back all through the topic.
Where we start
A simple random sample with and , and the two definitions:
Both share the sum of squares . It is enough to compute .
Step 1: open up the sum of squares
Expanding the square, . Summing over i, and since :
Why comes out of the sum: it does not depend on i, it is the same number in all n terms. And added n times gives .
Step 2: the expectation of each piece
By rule 1, . Each piece comes from rule 3:
where is rule 2.
And by rule 1. Notice that overshoots by exactly : that piece is what ends up producing the n − 1.
Step 3: put it together
The terms cancel. That is why the result holds for any mean.
Step 4: divide
And since , : is asymptotically unbiased.
Writing . The mean of a square is not the square of the mean: the variance, , is missing. If you drop it, you get and conclude that is unbiased, exactly the wrong way round.
Where does that n − 1 really come from? is computed from the same data, and it is the point that makes the sum of squares smallest (we saw it in descriptive statistics). Measuring the distances to instead of μ always gives something smaller, and dividing by n − 1 makes up for exactly that loss.
Result for the cheat sheet: ; ; .
Check it with R
With the trip distance, N(2.4, 0.7), and also with a population that is not normal (duration, exponential with mean 12 minutes, σ² = 144), with samples of 5:
set.seed(1)
ss_norm <- replicate(20000, { x <- rnorm(15, 2.4, 0.7); sum((x - mean(x))^2) })
ss_exp <- replicate(20000, { x <- rexp(5, 1 / 12); sum((x - mean(x))^2) })
round(c(S2_norm = mean(ss_norm / 14), S2prime_norm = mean(ss_norm / 15), theo_prime_norm = 14 / 15 * 0.49,
S2_exp = mean(ss_exp / 4), S2prime_exp = mean(ss_exp / 5), theo_prime_exp = 4 / 5 * 144), 3)
Output:
S2_norm S2prime_norm theo_prime_norm S2_exp
0.491 0.458 0.457 143.727
S2prime_exp theo_prime_exp
114.982 115.200
In the normal, gives 0.491 (σ² = 0.49) and gives 0.458, next to the formula . In the exponential the same happens, with a much more visible bias because n = 5: gives 143.7 (σ² = 144) and stays at 115, four fifths of 144.
Check you’ve got it: if you knew μ and measured the distances to μ instead of to the sample mean, would you have to divide by n − 1?
No, by n. Each has expectation (that is the definition of variance), so the sum has expectation by rule 1. The n − 1 only appears when μ is replaced by , which is computed from the same data and sticks to them: on average the sum loses one σ², the from step 2.
Proof 2: MSE equals variance plus squared bias
What we want to prove
Why it matters. It is the tool used to compare every estimator in the topic: the MSE comes from the variance and the bias, which you already know how to compute, without integrating . Proofs 4 and 5 use it.
Where we start
The definition of the MSE and that of the bias, . To write less, I call , which is a number, not a random variable.
Step 1: add and subtract the mean
I have not changed anything (), but I have split the error in two: how far the estimator strays from its own center and how far that center is from θ.
Why m and not some other number? Because it is the only one that makes the cross term vanish in step 4: how far the estimator strays from its own mean is 0 on average.
Step 2: square it
It is , with (the random part) and (a fixed number).
Step 3: take expectations
By rule 1, the expectation of the sum is the sum of the expectations. In the middle term, is a number and comes outside:
Step 4: the cross term is 0
. What is left:
The first piece is the definition of variance (the mean of the squares of how far it strays from its mean) and the second, the squared bias.
In the picture, the MSE is like the square of a hypotenuse: the legs are the standard deviation of the estimator and its bias. That is why the MSE is never smaller than the variance (as in my story) and why a small bias hardly counts: it enters squared.
Forgetting to square the bias. With a negative bias, gives a number smaller than the variance, which is impossible. If that happens, check the square.
Result for the cheat sheet: ; if it is unbiased, .
Check it with R
The identity is exact with the numbers of a simulation too, if the variance is computed dividing by the number of simulations (not with var(), which divides by B − 1):
set.seed(2) m <- replicate(10000, max(runif(12, 0, 2400))) # 10,000 maxima of 12 serial numbers c(mse = mean((m - 2400)^2), var_plus_bias2 = mean((m - mean(m))^2) + (mean(m) - 2400)^2)
Output:
mse var_plus_bias2
60426.9 60426.9
Identical to the last decimal: it is algebra, not an approximation.
Check you’ve got it: an estimator has variance 9 and bias −2. What is its MSE? Could it come out as 7?
13: . The 7 is what you get with the mistake from my story, , and it is impossible: the MSE never drops below the variance. With bias +2 you would also get 13: the sign does not count, because it enters squared.
Proof 3: the maximum of the uniform, its density, mean and variance
What we want to prove
If is a simple random sample from a uniform(0, θ) and :
Why it matters. The maximum is the MLE of θ in the uniform, but it is not a sum, so rules 1 and 2 do not help. Without its mean and variance there is no MSE of the maximum and no proof 4. And the trick of going through the distribution function works for any maximum or minimum.
Where we start
Each has distribution function on . The maximum has no direct formula, but it has an easy question: when is the maximum less than x?
Step 1: the distribution function of the maximum
The maximum of the twelve numbers is at most x if and only if all of them are at most x. By rule 4:
In the picture, on the left, for the maximum to stay below x all twelve scooters have to land in the shaded zone, and each does so with probability x/θ. On the right, the density that comes out: almost all its mass is pressed against θ.
Why multiply: each falls below x with probability , and by rule 4 the probability that all n do at once is the product of n equal factors.
Step 2: differentiate
It is the chain rule: bring down the n, subtract one from the exponent and multiply by the derivative of the inside, : .
Step 3: the mean
By rule 5:
What gets skipped: comes out of the integral because it does not depend on x; , whose antiderivative is ; and .
Step 4: the second moment
Step 5: the variance
By rule 3, over a common denominator:
In the numerator, . So
Writing . That is the minimum‘s, the other way round: for the minimum, “the minimum is greater than x” if all of them are greater than x. For the maximum, all of them smaller. If in doubt, try x = θ: the maximum’s must equal 1.
Result for the cheat sheet: ; ; ; ; .
Check it with R
With the fleet of 2400 and n = 12, integrating the density:
n <- 12; theta <- 2400 dmax <- function(x) n * x^(n - 1) / theta^n c(area = integrate(dmax, 0, theta)$value, mean = integrate(function(x) x * dmax(x), 0, theta)$value, theo_mean = n / (n + 1) * theta, var = integrate(function(x) x^2 * dmax(x), 0, theta)$value - (n / (n + 1) * theta)^2, theo_var = n * theta^2 / ((n + 1)^2 * (n + 2)))
Output:
area mean theo_mean var theo_var
1.000 2215.385 2215.385 29213.863 29213.863
The density integrates to 1, and the mean (2215.385) and variance (29,214) match the formulas: the maximum of 12 serial numbers falls, on average, 184.62 scooters short of the end of the fleet.
Check you’ve got it: with n = 1, what do the formulas for the mean and the variance of the maximum give? Does it make sense?
and : the mean and the variance of the uniform(0, θ). It has to be so, because the maximum of a single number is that number. Trying n = 1 is a quick way to check in the exam that you have written the formula correctly.
Proof 4: the three fleet estimators compared by MSE
What we want to prove
For the uniform(0, θ), with , and :
- , and .
- For n ≥ 2, has the smallest MSE.
- All three are consistent.
Why it matters. It answers the fleet question: with 12 serial numbers, which estimator should I use? And it shows that being unbiased is not enough: is unbiased too and loses by a long way. What decides is the MSE.
Where we start
The uniform(0, θ) has mean θ/2 and variance θ²/12. For the maximum, proof 3. And proof 2.
Step 1: the moments estimator
By rules 1 and 2: (unbiased) and
Why the 4: rule 2 takes the constant out squared, and is rule 2 with . MSE = Var because it is unbiased (b = 0 in proof 2).
Step 2: the maximum
Its bias is . By proof 2:
What gets skipped: the second term is multiplied top and bottom by (n + 2); on top you get n + n + 2 = 2(n + 1), which cancels with one (n + 1) underneath.
Step 3: the corrected maximum
It is unbiased: . By rule 2, the constant comes out squared:
The constant comes out squared; the cancel, and leaves .
Step 4: the ratios
The θ² cancel:
Both equal 1 when n = 1 (with a single scooter, and they coincide) and are greater than 1 for n ≥ 2: and . The corrected maximum is the best of the three. With n = 12, the ratios are 14/3 = 4.67 and 24/13 = 1.85.
In the picture, the MSE of each estimator (divided by θ²) as n grows, on a log scale. The two maximum lines fall with twice the slope of 2X̄’s: their MSE goes like , and the moments one like .
Step 5: consistency by the theorem
All three are (asymptotically) unbiased: and . And their variances have n in the denominator: , (degree 1 on top, degree 3 below) and . By rule 8, all three are consistent.
Step 6: the maximum, also by the definition
With the maximum you can go straight to the definition. Since always, being more than ε away can only happen from below:
because . With ε = 100 scooters and θ = 2400, the base is : with 12 scooters, , and with 200, . Those are exactly the “outside” proportions of the theory simulation (1 − 0.41 and 1 − 1.000).
Saying the maximum “is not consistent because it is biased”. Consistency asks for a bias that vanishes, not zero bias: the maximum is asymptotically unbiased and its variance goes to 0.
Result for the cheat sheet: uniform(0, θ): ; ; .
Check it with R
The ratios for several n, with the formulas, and the probability of being more than 100 scooters off:
n <- c(1, 2, 5, 12, 50, 200)
data.frame(n,
mom_over_cor = round((n + 2) / 3, 2),
max_over_cor = round(2 * n / (n + 1), 2),
P_out_max = signif((23 / 24)^n, 3))
Output:
n mom_over_cor max_over_cor P_out_max 1 1 1.00 1.00 0.958000 2 2 1.33 1.33 0.918000 3 5 2.33 1.67 0.808000 4 12 4.67 1.85 0.600000 5 50 17.33 1.96 0.119000 6 200 67.33 1.99 0.000201
With n = 1 all three tie; from n = 2 on, the corrected one always wins. The last column is , which goes to 0.
Check you’ve got it: with 12 serial numbers and θ = 2400, what is the square root of the MSE of each estimator? What does it mean in scooters?
: . Maximum: . Corrected: . It is in the same units as θ: it is the typical error, in scooters. With you are off by about 400; with the corrected one, by about 185.
Proof 5: S² versus S’² in the normal
What we want to prove
In a normal population:
Why it matters. It is the classic counterexample: the unbiased estimator is not the one with the smallest MSE. It comes up as “compare and by their MSE” and explains the 0.0343 against 0.0309 of the theory simulation. For the variances you do need the population to be normal.
Where we start
Rule 6: , with . And proof 1 for the biases.
Step 1: the variance of S²
Solving for it, . By rule 2:
Since is unbiased, that is its MSE.
Why : the constant comes out squared (rule 2). And the has variance 2(n − 1) (rule 6), which takes away one of the (n − 1) underneath.
Step 2: the MSE of S’²
, so , and its bias is (proof 1). By proof 2:
What gets skipped: the squared bias is , and with the same denominator .
Step 3: compare
which holds for every n ≥ 2. The biased estimator has the smaller MSE. What it loses through the bias it more than wins back in variance: multiplying by shrinks the variance.
Why you can multiply across in step 3: is positive (n ≥ 2 for to exist), so the inequality does not flip.
Step 4 (for the curious): the best divisor
What if we divide the sum of squares by some other number k? With and :
Calling m = n − 1, the derivative with respect to k vanishes when , which simplifies to , that is, . The smallest MSE comes from dividing by n + 1, and it is .
In the picture, the MSE of with n = 15 as a function of the divisor k: n − 1 = 14 (the sample variance S²) is to the left of the minimum, n = 15 closer, and the minimum is at 16.
Result for the cheat sheet: normal: ; (smaller than that of ).
Check it with R
The formulas with σ = 0.7 (σ⁴ = 0.2401) for several n, and the divisor that minimises the MSE, found with optimize:
s4 <- 0.7^4 n <- c(2, 5, 15, 50) data.frame(n, mse_S2 = round(2 * s4 / (n - 1), 4), mse_S2prime = round((2 * n - 1) * s4 / n^2, 4)) mse_k <- function(k, n = 15) (2 * (n - 1) + (n - 1 - k)^2) / k^2 round(optimize(mse_k, c(5, 40))$minimum, 2)
Output:
n mse_S2 mse_S2prime 1 2 0.4802 0.1801 2 5 0.1200 0.0864 3 15 0.0343 0.0309 4 50 0.0098 0.0095 [1] 16
With n = 15, 0.0343 against 0.0309, the two numbers the theory simulation gave. And optimize finds the minimum at k = 16 = n + 1.
Check you’ve got it: with n = 15 and σ = 0.7, what is the MSE when dividing by n + 1 = 16? Compare it with those of S² and S’².
, against 0.0309 for and 0.0343 for : the closer the divisor is to 16, the smaller the MSE, as in the picture. The gain from 15 to 16 is so small (0.0009) that nobody divides by n + 1: you use because it is unbiased or because it is the MLE.
Proof 6: X̄ is efficient in the Poisson and the normal
What we want to prove
- In a Poisson(λ), , the Cramér–Rao bound is λ/n and is efficient for λ.
- In a with σ known, , the bound is σ²/n and is efficient for μ.
Why it matters. The bound is a floor: no unbiased estimator has a smaller variance, so if one touches it, there is nothing better to look for. And the four-step plan works as it is for any other model in the exam.
Where we start
The bound for an unbiased estimator with a simple random sample of size n:
The plan is always the same, in four steps: the log of f for one observation, differentiate twice with respect to the parameter, the expectation with the sign changed, and divide.
Step 1: the Poisson, logarithm
The logarithm turns products and powers into sums: , , and moves over as a subtraction.
Step 2: differentiate twice with respect to λ
does not depend on λ and disappears:
When differentiating with respect to λ, x is a constant: gives , and the second time gives .
Step 3: the information
Replacing x with X and taking expectations (rule 1; λ is a number):
What is used: in a Poisson, . The minus sign in the definition is there so that the information comes out positive: the second derivative is negative.
Step 4: the bound and the variance
And is unbiased (). Variance equal to the bound: is efficient for λ.
Step 5: the normal, the same way
is efficient for μ. Here the second derivative does not even depend on x: the expectation is immediate.
Using the density of the whole sample in and then dividing by n again. If you differentiate , what comes out is already and the bound is its inverse, with no extra n. Pick one of the two forms and do not mix them.
Result for the cheat sheet: ; bound . Poisson: , bound . Normal (μ): , bound . Exponential: , bound .
Check it with R
The information is also the expectation of the square of the first derivative. With λ = 3.04 (the trips per hour) and the normal of the distances, computing that expectation with rule 5:
l <- 3.04; x <- 0:100 i_pois <- sum((-1 + x / l)^2 * dpois(x, l)) # E[(d log f / d lambda)^2] i_norm <- integrate(function(x) ((x - 2.4) / 0.49)^2 * dnorm(x, 2.4, 0.7), -Inf, Inf)$value round(c(i_pois = i_pois, theo_pois = 1 / l, i_norm = i_norm, theo_norm = 1 / 0.49), 4)
Output:
i_pois theo_pois i_norm theo_norm 0.3289 0.3289 2.0408 2.0408
Both forms of the information agree: 0.3289 = 1/3.04 and 2.0408 = 1/0.49.
Check you’ve got it: the estimator that always says 3, without looking at the data, has variance 0, less than the bound λ/n. Does it break Cramér–Rao?
No: the bound is for unbiased estimators, and this one has bias . If λ = 3.04, its MSE is ; if λ were 2, it would be 1, and you cannot know without looking at the data. Without that condition, guessing right by luck would always win.
Proof 7: the exponential MLE, bias, correction and asymptotic variance
What we want to prove
For an exponential(λ) with (the MLE, from the previous topic):
- : biased, but asymptotically unbiased.
- is unbiased, with , which does not reach the bound but gets closer to it.
- The asymptotic variance of is .
Why it matters. It puts the whole topic into one model: bias, correction, variance, bound and asymptotic variance. And it shows that the MLE can be biased: is unbiased, but its reciprocal is not.
Where we start
(rule 7), and .
Step 1: the expectation of 1/Y
By rule 5, with the gamma density:
The integral is the one in rule 7 with a = n − 1. And since :
What gets skipped: and . With n = 1, the integral of does not converge near 0.
Step 2: the bias of the MLE
It overshoots (with 20 trips, by 5 %), but it is asymptotically unbiased.
Step 3: correct it
Multiplying by : has . Unbiased.
Step 4: its variance
We need , as in step 1 but with :
using . By rule 3:
Why : , so , and is subtracted from it.
Step 5: compare it with the bound
In the exponential, , , and the bound is . Since , is not efficient. But the ratio : it is asymptotically efficient, as property 4 of the MLE promises.
Step 6: the asymptotic variance
With :
Which is the bound with λ replaced by its estimate.
Why : by the MLE property from the previous topic, its asymptotic variance is the inverse of the information of the whole sample, , with in place of λ.
Writing . Expectation does not pass through (it is not linear), and the difference is exactly the bias.
Result for the cheat sheet: exponential: ; unbiased with variance ; bound ; .
Check it with R
With λ = 1/12 (trips of 12 minutes on average) and n = 20:
set.seed(3)
lam <- 1 / 12; n <- 20
lh <- replicate(20000, 1 / mean(rexp(n, lam))) # 20,000 MLEs
lc <- (n - 1) / n * lh # the corrected ones
round(c(mean_mle = mean(lh), theo = n / (n - 1) * lam,
mean_cor = mean(lc), lambda = lam,
var_cor = var(lc), theo_var = lam^2 / (n - 2), bound = lam^2 / n), 5)
Output:
mean_mle theo mean_cor lambda var_cor theo_var bound 0.08779 0.08772 0.08340 0.08333 0.00039 0.00039 0.00035
The MLE goes to 0.0878, above λ = 0.0833, as says. The corrected one centres on λ, and its variance (0.00039) sits on the formula , a little above the bound .
Check you’ve got it: with 20 trips and a mean of 12 minutes, what are the MLE, the corrected estimator and the asymptotic standard deviation of the MLE?
trips per minute; , 5 % less; and (step 6). The correction removes 0.0042, much less than the spread: with 20 data points, more data matters more than the bias.
Prove it yourself
Three EC2-style proofs. Try them on paper before opening the solution.
1. Let be a simple random sample from a Bernoulli(p) (the scooter you find is faulty, 1, or not, 0). Prove that is unbiased, consistent and efficient.
See the solution to 1
Unbiased: .
Consistent: and it is unbiased: by the consistency theorem, it is.
Efficient: . Differentiating:
The bound is : efficient.
2. In a normal population, prove that is a consistent estimator of σ².
See the solution to 2
By proof 1, for every n. By proof 5 (rule 6), , which goes to 0 as n → ∞. By the consistency theorem (rule 8), is consistent. And so is : and .
3. Let be a simple random sample from a . By invariance, is the MLE of μ². Prove that it is biased, compute its bias, check that it is asymptotically unbiased and give an unbiased estimator of μ².
See the solution to 3
, so . By rule 3:
It is biased (it overshoots by 1/n), but : asymptotically unbiased. Subtracting the bias, is unbiased: . Careful: with small samples it can give a negative number, which makes no sense as an estimate of a square. Unbiased is not the same as sensible (as with the fleet).
When to use each result
| If you are asked… | Use | Watch out for… |
|---|---|---|
| to prove it is unbiased | with linearity (rule 1) | |
| the bias | the sign: negative = it falls short | |
| the MSE | (proof 2) | the square of the bias |
| which is more efficient | ratio of MSEs, cancelling θ | read whether they compare variances or MSEs |
| whether it is efficient | of one observation and | that it is unbiased and the support does not depend on θ |
| whether it is consistent | and (rule 8) | both conditions, not just the first |
| something about the maximum or minimum | the minimum: | |
| the asymptotic variance of the MLE | evaluate it at , not at θ |
Common mistakes when proving
- Skipping rule 3 and writing or .
- Forgetting to square the bias in the MSE.
- Putting the n in twice in the Cramér–Rao bound (information of the sample and then dividing by n as well).
- Applying Cramér–Rao to the uniform(0, θ), whose support depends on θ.
- Concluding “not consistent” because there is bias. Consistency asks for the bias to vanish, not for it to be absent.
- Using the minimum’s distribution for the maximum (or the other way round). Check at the end point: the maximum’s equals 1 at x = θ.
- Writing “it is easy to see that”. In the exam what counts is the step that justifies each equality; if you do not know which rule you are using, the step is wrong.
Try it in the R playground
Paste this script into the R playground. It checks proofs 3 and 4 at once with n = 8:
set.seed(10) theta <- 2400; n <- 8 m <- replicate(20000, max(runif(n, 0, theta))) c(mean_sim = mean(m), mean_theo = n / (n + 1) * theta, var_sim = var(m), var_theo = n * theta^2 / ((n + 1)^2 * (n + 2)), mse_max = mean((m - theta)^2), mse_theo = 2 * theta^2 / ((n + 1) * (n + 2))) hist(m, breaks = 50, freq = FALSE, main = "Maximum of 8 serial numbers", xlab = "scooters") curve(n * x^(n - 1) / theta^n, add = TRUE, col = "red", lwd = 2)
What to look at:
- In the console, each simulated value next to its formula.
- In Plots, the histogram pressed to the right and the red density curve on top.
- Change
nto 2: the density becomes a straight line (). - Type
?replicatein the console to see the help in the Help panel.
Summary
| Result | Formula |
|---|---|
| Bias of | |
| MSE | |
| Maximum of the uniform(0, θ) | , |
| Best fleet estimator | , MSE |
| MSE of and (normal) | and |
| Cramér–Rao bound | ; Poisson λ/n, normal σ²/n |
| Exponential MLE | ; |
Three ideas to take away:
- Almost everything comes from two tools: rule 3 () and the MSE decomposition.
- For anything about the maximum, start with “the maximum is below x if all of them are”.
- The Cramér–Rao bound is always computed the same way: log of one observation, two derivatives, expectation with the sign changed and divide by n.
With this you can simulate it all in the properties of estimators practice and then take on the exam-style exercises.
Next step: practiceProperties of estimators — R practice with simulations of bias, MSE, the Cramér–Rao bound and consistency (and the 10,000 variances I did not ask for)Did this article help you? Here is how you can support SergioLearns →



