Properties of estimators — theory with a scooter fleet, bias, mean squared error, Cramér–Rao and consistency (and the fleet smaller than one scooter)

On Tuesday, waiting for the bus in Tafira, I wrote down the numbers of the twelve rental scooters parked nearby and set out to estimate how big the fleet was with the method of moments: twice the mean of the numbers. I got 1979.33. The trouble was that one of the scooters right in front of me was number 2373. My estimate said there were fewer scooters than the number on one I was looking at. It was the moments estimator, correctly derived, without a single arithmetic slip. That day I understood that deriving an estimator is half the job: the other half is knowing whether it is any good.

In the point estimation proofs and their theory we learnt to get estimators in two ways: moments and maximum likelihood. They often give different estimators. Today we look at the criteria for deciding which one is better: unbiasedness (being right on average), mean squared error and efficiency (being wrong by little), the Cramér–Rao bound (the least an unbiased estimator can vary) and consistency (getting closer to the parameter as the sample grows). At the end, the five properties the maximum likelihood estimator has when n is large. The complete proofs, step by step, are in the properties of estimators proofs.

In a nutshell: the properties of estimators are the criteria for deciding whether an estimator is good: unbiasedness (it is right on average), efficiency (it has the smallest mean squared error, and the smallest variance the Cramér–Rao bound allows) and consistency (it gets closer to the parameter as the sample grows). The maximum likelihood estimator meets almost all of them when n is large: it is consistent, asymptotically unbiased, efficient and normal.

Before you start. For this topic you need four things you already have: getting an estimator by moments and by maximum likelihood (the previous topic); the rules for expectation and variance, above all E(aX)=a E(X) E(aX) = a\,E(X) and Var(aX)=a2 Var(X) \text{Var}(aX) = a^2\,\text{Var}(X) ; that E(Xˉ)=μ E(\bar X) = \mu and Var(Xˉ)=σ2/n \text{Var}(\bar X) = \sigma^2/n ; and differentiating a logarithm. Nothing else. The topic goes in this order: first, the idea that organises everything, that an estimator changes with the sample; then, whether it is right on average (the bias); next, how wrong it is overall (the mean squared error), which adds up the scatter and the shift; with that, which one is more efficient and how low the variance can go (the Cramér–Rao bound); and finally, what happens when the sample grows (consistency) and why the maximum likelihood estimator meets almost all of it. If you get lost, go back to the 12 scooters at the stop: the whole topic can be understood with them.

The scooter fleet

The example for the whole topic is an electric scooter rental company that has arrived in Las Palmas de Gran Canaria. It does not say how many scooters it has or how long rides last, and we want to find out from what we can see in the street. We will use four series (made up, but shaped like real ones):

  • Serial numbers: the numbers of the 12 scooters I saw at the Tafira stop. The fleet is numbered from 1 to θ, and θ is exactly what we want to estimate. With thousands of scooters, the number of any one of them behaves like a continuous uniform(0, θ) (the difference between scooter 2373 and 2373.4 does not matter).
  • Trips per hour: how many trips left the campus station in 24 different hours. A count: Poisson(λ).
  • Duration: the minutes of 20 trips. Positive, with many short ones and a few long ones: exponential(λ), with mean 1/λ.
  • Distance: the kilometres of 15 trips. They cluster around a mean with no odd tails: normal N(μ, σ).
serial   <- c(2373, 955, 278, 167, 585, 1901, 816, 2333, 398, 1102, 412, 556)
trips    <- c(3, 2, 3, 4, 1, 2, 2, 2, 4, 3, 4, 4, 1, 4, 3, 3, 1, 2, 3, 5, 5, 4, 5, 3)
duration <- c(0.2, 11.0, 9.0, 18.9, 2.8, 13.0, 27.9, 8.7, 15.5, 8.1,
              5.1, 13.4, 15.8, 5.0, 8.1, 19.6, 0.9, 30.8, 20.9, 3.5)   # minutes
distance <- c(2.41, 2.27, 1.44, 1.98, 2.61, 2.67, 1.55, 2.15, 1.26, 2.22,
              3.17, 2.93, 2.23, 3.09, 2.92)                            # km

With the serial numbers there are three estimators of θ that make sense, and all three came up in the previous topic:

  • Moments: since the mean of the uniform(0, θ) is θ/2, setting it equal to the sample mean gives θ~=2Xˉ \tilde\theta = 2\bar X .
  • Maximum likelihood: the likelihood of the uniform grows up to the largest number you have seen and drops to 0 below it, so θ^=max⁡(Xi) \hat\theta = \max(X_i) , which we will write X(n) X_{(n)} .
  • The corrected maximum: θ^c=n+1nX(n) \hat\theta_c = \frac{n+1}{n} X_{(n)} . You will see shortly where it comes from.
n <- length(serial)
round(c(moments   = 2 * mean(serial),
        maximum   = max(serial),
        corrected = (n + 1) / n * max(serial)), 2)

Output:

  moments   maximum corrected 
  1979.33   2373.00   2570.75 

Three very different numbers for the same fleet: 1979, 2373 and 2571 scooters. The first is the one from my story, impossible because there is a scooter with a higher number. The second is the smallest the fleet can be. The third goes past the largest number seen by a twelfth. Which one do I believe? This sample alone cannot answer that: we have to ask how each estimator behaves if we repeated the sample many times.

An estimator is a random variable

This is the idea that puts everything in order. An estimator is a formula applied to the sample, θ^=θ^(X1,…,Xn) \hat\theta = \hat\theta(X_1, \dots, X_n) . Since the sample is random (another day I would have seen twelve other scooters), so is the estimator: it has its own distribution, mean and variance. It is what happened to Xˉ \bar X in sampling distributions: there we called it the sampling distribution. The estimate is the number it gives with your sample (1979.33): a single realisation.

Judging an estimator by one estimate is like judging a darts player by a single throw. What matters is many throws: whether they land around the center and whether they land close together.

Bias and variance as dartboardsFour dartboards in two rows and two columns, ten darts each. Top left the darts land close together around the center (no bias, low variance). Top right they land close together but off center (biased, low variance). Bottom left around the center but spread out (no bias, high variance). Bottom right, off center and spread out.No bias, low varianceBiased, low varianceNo bias, high varianceBiased, high variance
Each dart is the estimate from one sample. Bias shifts the group; variance spreads it.

Look at the picture: in the top-left board the darts land centred and close together, the ideal. Top right they land close together but shifted: bias. Bottom left they land centred but scattered: variance. Both spoil the estimator, and the mean squared error (below) adds them up.

With R we can do what we cannot in the street: make up a fleet of θ = 2400 scooters, draw 10,000 samples of 12 numbers and apply the three estimators to each one. replicate repeats the block and stores the three values of each sample in a column:

set.seed(25)
theta <- 2400; n <- 12
sims <- replicate(10000, {
  x <- runif(n, 0, theta)          # 12 serial numbers from a fleet of 2400
  c(moments   = 2 * mean(x),
    maximum   = max(x),
    corrected = (n + 1) / n * max(x))
})
round(rowMeans(sims), 2)           # the mean of each estimator over the 10,000 samples

Output:

  moments   maximum corrected 
  2400.09   2214.55   2399.10 

sims is a matrix with 3 rows (one per estimator) and 10,000 columns (one per sample), so rowMeans gives the mean of each estimator. The picture of the three distributions makes these numbers clear:

The distributions of the three fleet estimatorsThree densities over the axis of the estimated fleet size, from 1000 to 3600, with a dashed line at theta equal to 2400. The 2X̄ one, in violet, is a wide bell centred at 2400. The maximum, in coral, rises up to 2400 and stops there without passing it. The corrected maximum, in green, has the same shape stretched a little to the right and reaches 2600.0.0000.0020.0041,0001,6002,4003,0003,600fleet size estimate (scooters)densityθ = 24002X̄maximumcorrected max
With n = 12: 2X̄ centred but wide; the maximum, narrow but short; the corrected one, narrow and centred.

In the picture, the 2X̄ curve (violet) is centred at 2400 but very wide: with 12 scooters it can give 1700 or 3100. The maximum’s curve (coral) is pressed to the left of 2400 and never passes it, because no scooter you see can have a number larger than the fleet. The corrected maximum’s (green) is as narrow as the maximum’s, but shifted right just enough to be centred on 2400.

Unbiasedness and bias

Before the definition: bias in numbers

Before giving it a name, look again at the simulation above. We made up a fleet of 2400 scooters, drew 10,000 samples of 12 and computed the mean of each estimator. All you have to do is subtract the real fleet:

EstimatorMean of the 10,000 estimatesReal fleetDifferenceWhy
2Xˉ 2\bar X 2400.0924000.09the errors above and below cancel out: what is left is noise
X(n) X_{(n)} 2214.552400−185.45the maximum never goes past 2400, so it cannot make up for it from above
n+1nX(n) \frac{n+1}{n}X_{(n)} 2399.102400−0.90noise again: the correction undoes the maximum’s gap

That last column is the bias: how far, on average, the center of the darts is from the center of the board. If it comes out as 0 (or noise), the estimator is right on average; if not, it always drifts to the same side.

Why does the maximum fall short by exactly about 185? There is a way to see it without any algebra. The 12 numbers fall at random between 0 and 2400 and split that stretch into 13 pieces: the one before the first, the 11 in between and the one after the last. By symmetry, on average the 13 pieces have the same length: 2400/13=184.62 2400/13 = 184.62 . The last piece is exactly what the maximum is missing to reach the fleet. That is why, on average, the maximum is 2400−184.62=2215.38 2400 – 184.62 = 2215.38 , which is 1213⋅2400 \frac{12}{13} \cdot 2400 .

And that is where the correction comes from, with no magic: if the maximum is, on average, one piece short, add one. Since the maximum takes up 12 pieces, one piece is X(n)/12 X_{(n)}/12 , and X(n)+X(n)/12=1312X(n) X_{(n)} + X_{(n)}/12 = \frac{13}{12}X_{(n)} . That is the corrected maximum.

Look also at the extreme case, with a single scooter (n = 1). The maximum is that one number, which on average is 2400/2=1200 2400/2 = 1200 : a bias of −1200. And the corrected one is 21X1=2X1 \frac{2}{1}X_1 = 2X_1 , which is exactly 2Xˉ 2\bar X . With one scooter, moments and corrected maximum are the same estimator; with more, they part ways because the maximum uses the highest number and the mean mixes them all.

Check you’ve got it: if you only saw 3 scooters from a fleet of 2400, what would the maximum be on average, what would its bias be and what would you multiply it by?

With 3 numbers there are 4 pieces, which on average measure 2400/4=600 2400/4 = 600 . The maximum stays one piece short of the fleet: on average, 2400−600=1800 2400 – 600 = 1800 , which is 34⋅2400 \frac{3}{4} \cdot 2400 . Its bias is 1800−2400=−600 1800 – 2400 = -600 , the same as the formula −θ/(n+1)=−2400/4 -\theta/(n+1) = -2400/4 gives. To correct it you add one piece, which is a third of the maximum: you multiply by 43 \frac{4}{3} , which is n+1n \frac{n+1}{n} with n = 3. With fewer scooters the gap is bigger and the correction weighs more.

Now, the official names for what you have just computed.

An estimator θ^ \hat\theta is unbiased if E(θ^)=θ E(\hat\theta) = \theta for every possible value of θ. Otherwise it is biased, and its bias is

b(θ^)=E(θ^)−θ b(\hat\theta) = E(\hat\theta) – \theta

The bias is the distance between the center of the darts and the bullseye. Note the “for every θ”: it is not enough to be right on average when the fleet has 2400 and wrong when it has 5000. It must be right whatever the parameter, because you do not know the parameter.

round(rowMeans(sims) - theta, 2)   # bias of each estimator in the simulation

Output:

  moments   maximum corrected 
     0.09   -185.45     -0.90 

How to read it

  • moments 0.09: on average, 2X̄ lands 0.09 scooters from 2400. That is simulation noise (with another 10,000 samples it would come out −3 or 4): 2X̄ is unbiased. It takes one line to prove: E(2Xˉ)=2E(X)=2⋅θ2=θ E(2\bar X) = 2 E(X) = 2 \cdot \frac{\theta}{2} = \theta .
  • maximum −185.45: the maximum falls short, on average, by about 185 scooters. It is biased downwards, and this is not noise: it makes sense, because the maximum of 12 numbers cannot go past θ and almost never reaches it. Theory says E(X(n))=nn+1θ E(X_{(n)}) = \frac{n}{n+1}\theta , that is, 1213⋅2400=2215.38 \frac{12}{13} \cdot 2400 = 2215.38 , and its bias is −θn+1=−184.62 -\frac{\theta}{n+1} = -184.62 . The simulation gives 2214.55 and −185.45: it matches.
  • corrected −0.90: multiplying the maximum by n+1n \frac{n+1}{n} undoes exactly that bias: E(n+1nX(n))=n+1n⋅nn+1θ=θ E\left(\frac{n+1}{n}X_{(n)}\right) = \frac{n+1}{n} \cdot \frac{n}{n+1}\theta = \theta . That is where the corrected maximum comes from: it is the maximum, fixed so that it is unbiased.

The density of the maximum and its expectation (which is where almost everyone gets stuck) are worked out in proof 3.

And what about my story? In the simulation we can count how often 2X̄ gives a value below the maximum of its own sample, that is, a fleet smaller than a scooter you are looking at:

mean(sims["moments", ] < sims["maximum", ])

Output:

[1] 0.3055

30.55 % of the samples. Unbiased does not mean sensible: 2X̄ is right on average, but almost one time in three it gives an impossible fleet. It was not bad luck: it was what happens to this estimator once in every three samples.

Thinking that “unbiased” means “gives the right value”. An unbiased estimator can be very wrong in each sample: it only promises that, repeating the sample many times, the errors above and below cancel out.

The two sample variances

The classic example of the topic, and the one that comes up most, is the variance. With the trip distances (normal), there are two candidates to estimate σ²:

S2=1n−1∑i=1n(Xi−Xˉ)2(sample variance) S^2 = \frac{1}{n-1}\sum_{i=1}^n (X_i – \bar X)^2 \qquad\text{(sample variance)}
S′2=1n∑i=1n(Xi−Xˉ)2=n−1nS2(dividing by n) S'^2 = \frac{1}{n}\sum_{i=1}^n (X_i – \bar X)^2 = \frac{n-1}{n}S^2 \qquad\text{(dividing by n)}

S2 S^2 is unbiased for σ² in any population with a variance (not only the normal): E(S2)=σ2 E(S^2) = \sigma^2 . That is why S′2 S'^2 is biased:

E(S′2)=n−1nE(S2)=n−1nσ2,b(S′2)=n−1nσ2−σ2=−σ2n E(S'^2) = \frac{n-1}{n}E(S^2) = \frac{n-1}{n}\sigma^2, \qquad b(S'^2) = \frac{n-1}{n}\sigma^2 – \sigma^2 = -\frac{\sigma^2}{n}

It falls short by an n-th of σ². And in R, var() computes S2 S^2 , the one that divides by n − 1:

round(c(S2 = var(distance), S2prime = var(distance) * 14 / 15), 4)

Output:

     S2 S2prime 
 0.3513  0.3278 

With 15 trips, 0.3513 km² against 0.3278 km². S′2 S'^2 is also the maximum likelihood estimator of σ² in the normal (we saw it in the previous topic), so the MLE can be biased.

Asymptotically unbiased

An estimator is asymptotically unbiased if lim⁡n→∞E(θ^n)=θ \lim_{n\to\infty} E(\hat\theta_n) = \theta . The bias can exist, but it vanishes as the sample grows. Both biased estimators we have are:

E(S′2)=n−1nσ2→n→∞σ2,E(X(n))=nn+1θ→n→∞θ E(S'^2) = \frac{n-1}{n}\sigma^2 \xrightarrow[n\to\infty]{} \sigma^2, \qquad E(X_{(n)}) = \frac{n}{n+1}\theta \xrightarrow[n\to\infty]{} \theta

With 12 scooters the maximum falls short by 7.7 % (1/13); with 1000, by 0.1 %.

The unbiased estimator is not unique

The same parameter can have many unbiased estimators. With the fleet we already have two: 2X̄ and the corrected maximum. And you can make more: in a population with mean μ, 12Xˉ+12X1 \frac12\bar X + \frac12 X_1 is also unbiased, because E(12Xˉ+12X1)=12μ+12μ=μ E\left(\frac12\bar X + \frac12 X_1\right) = \frac12\mu + \frac12\mu = \mu . With the trips per hour (Poisson), the mean and the variance are both λ, so Xˉ \bar X and S2 S^2 are both unbiased for λ.

If there are several unbiased ones, unbiasedness does not decide. We need another criterion: how much they scatter.

The mean squared error

The mean squared error of an estimator is the mean of its squared error:

MSE(θ^)=E[(θ^−θ)2] \text{MSE}(\hat\theta) = E\left[(\hat\theta – \theta)^2\right]

And it splits into two pieces you already know:

MSE(θ^)=Var(θ^)+b(θ^)2 \text{MSE}(\hat\theta) = \text{Var}(\hat\theta) + b(\hat\theta)^2

It is the dartboards in numbers: the scatter (variance) plus the shift (bias, squared). The cross term of the square vanishes because E(θ^−E(θ^))=0 E(\hat\theta – E(\hat\theta)) = 0 ; the step-by-step version is in proof 2. For an unbiased estimator, b=0 b = 0 and the MSE is its variance.

MSE = variance + bias², step by step

The decomposition is the calculation that comes up most in this topic, so it is worth seeing it without skipping anything. The idea, before the formulas: the error of an estimator, θ^−θ \hat\theta – \theta , can be split into two stretches. First, how far this estimate is from the center of its own distribution; then, how far that center is from θ. The first stretch changes with every sample (it is the scatter); the second is always the same (it is the bias).

StepWhat is leftWhy
1MSE(θ^)=E[(θ^−θ)2] \text{MSE}(\hat\theta) = E\left[(\hat\theta – \theta)^2\right] the definition: mean of the squared error
2θ^−θ=(θ^−E(θ^))+(E(θ^)−θ) \hat\theta – \theta = \left(\hat\theta – E(\hat\theta)\right) + \left(E(\hat\theta) – \theta\right) add and subtract E(θ^) E(\hat\theta) : it changes nothing, but splits the error into the two stretches
3(a+b)2=a2+2ab+b2 (a + b)^2 = a^2 + 2ab + b^2 with a=θ^−E(θ^) a = \hat\theta – E(\hat\theta) and b=E(θ^)−θ b = E(\hat\theta) – \theta the good old square of a sum
4E(a2)+2b E(a)+b2 E(a^2) + 2b\,E(a) + b^2 linearity of expectation; b is a fixed number (it does not depend on the sample), so it comes outside
5E(a)=E(θ^)−E(θ^)=0 E(a) = E(\hat\theta) – E(\hat\theta) = 0 on average, an estimator does not move away from its own center: the cross term vanishes
6E(a2)=Var(θ^) E(a^2) = \text{Var}(\hat\theta) and b2=b(θ^)2 b^2 = b(\hat\theta)^2 the first is the definition of variance; the second, that of bias
7MSE(θ^)=Var(θ^)+b(θ^)2 \text{MSE}(\hat\theta) = \text{Var}(\hat\theta) + b(\hat\theta)^2 putting steps 4, 5 and 6 together

The step people forget most is step 4: you have to notice that E(θ^)−θ E(\hat\theta) – \theta is not random. Once you see it, the rest follows on its own.

With numbers, the fleet’s maximum. The simulation below gives a variance of 29,296 and a squared bias of 34,391, and 29,296+34,391=63,687 29{,}296 + 34{,}391 = 63{,}687 , exactly its MSE. With the formulas: the variance is 12⋅24002132⋅14=29,213.86 \frac{12 \cdot 2400^2}{13^2 \cdot 14} = 29{,}213.86 , the bias is −184.62 -184.62 and its square 34,082.84; added up, 63,296.70, which is the theoretical MSE you will see in the table below. Notice that the bias, once squared, weighs the same whether it is negative or positive: falling short by 185 scooters costs the same as overshooting by 185.

Check you’ve got it: one estimator has bias −10 and variance 300; another is unbiased and has variance 450. Which has the smaller MSE?

The biased one. Its MSE is 300+(−10)2=300+100=400 300 + (-10)^2 = 300 + 100 = 400 ; the unbiased one’s is its variance, 450. Even though the first always drifts to the same side, it scatters so much less that overall it is wrong by less. It is the same thing that happens further down with S′2 S'^2 against S2 S^2 . And if you forget to square it, you would get 300−10=290 300 – 10 = 290 , an MSE smaller than the variance, which is impossible.

Of two estimators, the better one has the smaller MSE (for every θ). And between two unbiased ones, the one with smaller variance: θ^1 \hat\theta_1 is said to be more efficient than θ^2 \hat\theta_2 if Var(θ^1)<Var(θ^2) \text{Var}(\hat\theta_1) < \text{Var}(\hat\theta_2) .

With the simulation, the MSE is the mean of the squared errors, and the variance comes from subtracting the squared bias:

mse  <- rowMeans((sims - theta)^2)    # E[(estimator - theta)^2] over the 10,000 samples
bias <- rowMeans(sims) - theta
round(rbind(variance = mse - bias^2,
            bias2    = bias^2,
            mse      = mse))

Output:

         moments maximum corrected
variance  159814   29296     34383
bias2          0   34391         1
mse       159814   63687     34383

And the theoretical formulas, proved in proof 4:

EstimatorBiasVarianceMSE
2Xˉ 2\bar X 0θ23n \frac{\theta^2}{3n} θ23n \frac{\theta^2}{3n}
X(n) X_{(n)} −θn+1 -\frac{\theta}{n+1} nθ2(n+1)2(n+2) \frac{n\theta^2}{(n+1)^2(n+2)} 2θ2(n+1)(n+2) \frac{2\theta^2}{(n+1)(n+2)}
n+1nX(n) \frac{n+1}{n}X_{(n)} 0θ2n(n+2) \frac{\theta^2}{n(n+2)} θ2n(n+2) \frac{\theta^2}{n(n+2)}
round(c(moments   = theta^2 / (3 * n),
        maximum   = 2 * theta^2 / ((n + 1) * (n + 2)),
        corrected = theta^2 / (n * (n + 2))))

Output:

  moments   maximum corrected 
   160000     63297     34286 

How to read it

  • Row variance: 2X̄ has a variance of 159,814 scooters² (a standard deviation of about 400 scooters); the maximum, 29,296 (about 171); the corrected one, 34,383 (about 185). The moments estimator scatters more than twice as much in standard deviation.
  • Row bias2: only the maximum has a real bias: 34,391 = 185.45². The other two have 0 and 1 (the noise of −0.90, squared).
  • Row mse: the sum of the two above. The corrected maximum wins (34,383), then the plain maximum (63,687) and far behind 2X̄ (159,814). The square root of the MSE reads in scooters: the corrected one is typically off by about √34,383 ≈ 185 scooters; 2X̄, by about 400.
  • The formulas give 160,000, 63,297 and 34,286: the simulation is within 1 % of each.
Each estimator MSE split into variance and squared biasThree horizontal bars. The 2X̄ bar is all variance and measures 159,814. The maximum has 29,296 of variance and 34,391 of squared bias, 63,687 in total. The corrected maximum is almost all variance, 34,383, and is the shortest.050,000100,000150,0002X̄MSE 159,814maximumMSE 63,687correctedMSE 34,383scooters²variancebias²
The maximum has the smallest variance, but its squared bias leaves it behind the corrected one.

The picture shows the odd thing about the plain maximum: it has less variance than the corrected one (multiplying by 13/12 stretches the distribution), but it carries a bias, and the squared bias weighs more than what it saves in variance. The corrected one pays a little variance to get rid of all the bias, and it pays off.

To compare two estimators you use the ratio of their MSEs (the relative efficiency):

round(mse["moments"] / mse["corrected"], 2)

Output:

moments 
   4.65 

2X̄ has an MSE 4.65 times larger than the corrected maximum. With the formulas, the ratio is exact: θ2/(3n)θ2/(n(n+2))=n+23=143=4.67 \frac{\theta^2/(3n)}{\theta^2/(n(n+2))} = \frac{n+2}{3} = \frac{14}{3} = 4.67 . And it grows with n: with 100 scooters seen, the corrected one is 34 times better. With the same number of scooters seen, the moments estimator throws information away: it only uses the mean, when the highest number says much more about the size of the fleet.

Where the 4.67 comes from

That calculation is squeezed into one line; unfolded, it goes like this. First the MSE of 2Xˉ 2\bar X , which, since it is unbiased, equals its variance:

StepCalculationWhy
1Var(X)=θ212 \text{Var}(X) = \frac{\theta^2}{12} the variance of a uniform(0, θ) is (θ−0)2/12 (\theta – 0)^2/12
2Var(Xˉ)=θ212n \text{Var}(\bar X) = \frac{\theta^2}{12n} Var(Xˉ)=σ2/n \text{Var}(\bar X) = \sigma^2/n with independent samples
3Var(2Xˉ)=4⋅θ212n=θ23n \text{Var}(2\bar X) = 4 \cdot \frac{\theta^2}{12n} = \frac{\theta^2}{3n} Var(aX)=a2 Var(X) \text{Var}(aX) = a^2\,\text{Var}(X) : the 2 comes out squared
4θ2/(3n)θ2/(n(n+2))=n(n+2)3n \frac{\theta^2/(3n)}{\theta^2/(n(n+2))} = \frac{n(n+2)}{3n} dividing fractions is multiplying by the reciprocal; the θ2 \theta^2 goes away
5n+23 \frac{n+2}{3} the n on top and the n below cancel
612+23=143=4.67 \frac{12+2}{3} = \frac{14}{3} = 4.67 with the 12 scooters at the stop

With 2400 scooters, the table above gives 160,000 over 34,286, which is also 4.67. The key is step 5: the ratio does not depend on θ, only on n, and it grows with it (with n = 100 it is 102/3=34 102/3 = 34 ). That is why you can say “the corrected one is more efficient” without knowing how many scooters the fleet has. When you do this ratio in an exam and θ is still in it, check again: you have almost certainly missed a square.

To decide which is more efficient in an exam, compute the ratio MSE1/MSE2 \text{MSE}_1 / \text{MSE}_2 and simplify. If it is greater than 1 for every n, the second is better. The θ² always cancel, and what is left is a function of n.

The biased one that wins: S² against S’²

Now a surprise with the distance. S2 S^2 is unbiased and S′2 S'^2 is not, but in a normal S′2 S'^2 has a smaller MSE. With the formulas from proof 5:

MSE(S2)=2σ4n−1,MSE(S′2)=(2n−1) σ4n2 \text{MSE}(S^2) = \frac{2\sigma^4}{n-1}, \qquad \text{MSE}(S'^2) = \frac{(2n-1)\,\sigma^4}{n^2}

and 2n−1n2<2n−1 \frac{2n-1}{n^2} < \frac{2}{n-1} for every n ≥ 2. Let us check it by simulating 10,000 samples of 15 trips with μ = 2.4 km and σ = 0.7 km (σ² = 0.49):

set.seed(15)
s2 <- replicate(10000, var(rnorm(15, 2.4, 0.7)))      # S^2 of each sample
round(c(mse_S2      = mean((s2 - 0.49)^2),
        mse_S2prime = mean((s2 * 14 / 15 - 0.49)^2)), 4)

Output:

     mse_S2 mse_S2prime 
     0.0342      0.0309 

Theory gives 2⋅0.492/14=0.0343 2 \cdot 0.49^2/14 = 0.0343 and 29⋅0.492/225=0.0309 29 \cdot 0.49^2/225 = 0.0309 : the simulation matches. The MSE does not always reward the unbiased one. If you are asked “which is more efficient?” by the MSE criterion, the biased one wins here. That is why, in an exam, you have to read carefully whether you are asked to compare variances of unbiased estimators or MSEs.

And where does 2n−1n2<2n−1 \frac{2n-1}{n^2} < \frac{2}{n-1} for every n ≥ 2 come from? You can see it in three steps:

StepWhat is leftWhy
1(2n−1)(n−1)<2n2 (2n-1)(n-1) < 2n^2 both sides are multiplied by n2(n−1) n^2(n-1) , which is positive, so the inequality does not flip
22n2−3n+1<2n2 2n^2 – 3n + 1 < 2n^2 expand the product: 2n2−2n−n+1 2n^2 – 2n – n + 1
31<3n 1 < 3n cross out the 2n2 2n^2 and move the −3n -3n to the other side; with n ≥ 2 it always holds

With the 15 trips: 29/225=0.13 29/225 = 0.13 against 2/14=0.14 2/14 = 0.14 . The difference is small, but always in favour of S′2 S'^2 . Dividing by n instead of n − 1 shrinks every estimate a little; that brings in bias, but it also removes scatter, and in the normal the second wins.

The Cramér–Rao bound

Among unbiased estimators, the one with the smallest variance wins. How low can it go? There is a floor, and it can be computed before you have any estimator.

The idea before the formula

Before the derivatives, think about what that floor ought to depend on. If each data point says a lot about θ, with few data you already pin it down and the floor is low. If each data point says little, even the best estimator wobbles. So you need to measure how much a data point says about θ, and that is the Fisher information. The way to measure it, in three steps:

  • Take one data point and look at its log-density as a function of θ. The data point is fixed; what you move is θ. It is the same as what you did with the likelihood in the previous topic, but with a single observation.
  • Look at its slope. The derivative ∂∂θlog⁡f(x∣θ) \frac{\partial}{\partial\theta}\log f(x \mid \theta) tells you how much the plausibility of that data point changes if you move θ a little. If it changes a lot, the data point tells one θ from another well; if it barely changes, the data point does not care about the value of θ and does not help you find it.
  • Take the mean of that slope squared. Squared so that negative slopes do not cancel out positive ones. That mean is i(θ) i(\theta) . The second form of the formula, with the second derivative, measures the same thing through the curvature: a very curved log-density is a sharp peak, and a sharp peak is a θ that is easy to locate.

With n independent data points, the information adds up: n times i(θ) i(\theta) . And the floor is its reciprocal, 1n i(θ) \frac{1}{n\,i(\theta)} : more information, less possible variance. Now, the version in the course notes.

For a population with density (or probability mass function) f(x∣θ) f(x \mid \theta) , the Fisher information of one observation is

i(θ)=E[(∂log⁡f(X∣θ)∂θ)2]=−E[∂2log⁡f(X∣θ)∂θ2] i(\theta) = E\left[\left(\frac{\partial \log f(X\mid\theta)}{\partial\theta}\right)^2\right] = -E\left[\frac{\partial^2 \log f(X\mid\theta)}{\partial\theta^2}\right]

and the Cramér–Rao inequality says that, under certain regularity conditions, any unbiased estimator of θ with a sample of size n satisfies

Var(θ^n)≥1n i(θ) \text{Var}(\hat\theta_n) \ge \frac{1}{n\, i(\theta)}

That floor is the Cramér–Rao bound. An unbiased estimator whose variance equals the bound is called efficient: you cannot do better without introducing bias. (The course notes also call it the uniformly minimum variance unbiased estimator.)

The information measures how much each data point says about θ: if the log-density is very peaked (very negative second derivative), each observation pins θ down well and the bound is small.

Trips per hour: Xˉ \bar X is efficient

For the Poisson, log⁡f(x∣λ)=−λ+xlog⁡λ−log⁡(x!) \log f(x\mid\lambda) = -\lambda + x\log\lambda – \log(x!) . Differentiating twice:

∂log⁡f∂λ=−1+xλ,∂2log⁡f∂λ2=−xλ2 \frac{\partial \log f}{\partial\lambda} = -1 + \frac{x}{\lambda}, \qquad \frac{\partial^2 \log f}{\partial\lambda^2} = -\frac{x}{\lambda^2}
i(λ)=−E[−Xλ2]=E(X)λ2=λλ2=1λ,bound=1n⋅1λ=λn i(\lambda) = -E\left[-\frac{X}{\lambda^2}\right] = \frac{E(X)}{\lambda^2} = \frac{\lambda}{\lambda^2} = \frac1\lambda, \qquad \text{bound} = \frac{1}{n \cdot \frac1\lambda} = \frac{\lambda}{n}

The same calculation, with no jumps

Those two lines hide seven steps. Unfolded:

StepWhat is leftWhy
1f(x∣λ)=e−λλxx! f(x \mid \lambda) = \frac{e^{-\lambda}\lambda^x}{x!} the Poisson probability mass function
2log⁡f=−λ+xlog⁡λ−log⁡(x!) \log f = -\lambda + x\log\lambda – \log(x!) the log of a product is the sum of the logs; log⁡e−λ=−λ \log e^{-\lambda} = -\lambda and log⁡λx=xlog⁡λ \log \lambda^x = x\log\lambda
3∂log⁡f∂λ=−1+xλ \frac{\partial \log f}{\partial\lambda} = -1 + \frac{x}{\lambda} x is a fixed number; log⁡(x!) \log(x!) has no λ in it, so its derivative is 0
4∂2log⁡f∂λ2=−xλ2 \frac{\partial^2 \log f}{\partial\lambda^2} = -\frac{x}{\lambda^2} x/λ=x λ−1 x/\lambda = x\,\lambda^{-1} , and the derivative of λ−1 \lambda^{-1} is −λ−2 -\lambda^{-2}
5E[−Xλ2]=−E(X)λ2=−λλ2=−1λ E\left[-\frac{X}{\lambda^2}\right] = -\frac{E(X)}{\lambda^2} = -\frac{\lambda}{\lambda^2} = -\frac{1}{\lambda} x is replaced by X to take the expectation; λ is constant and comes outside; in the Poisson E(X)=λ E(X) = \lambda
6i(λ)=1λ i(\lambda) = \frac{1}{\lambda} the formula has a minus sign in front: −(−1/λ) -(-1/\lambda)
71n i(λ)=1n/λ=λn \frac{1}{n\,i(\lambda)} = \frac{1}{n/\lambda} = \frac{\lambda}{n} the bound, with n hours

With our data, λ^=3.04 \hat\lambda = 3.04 : each hour brings an information of about 1/3.04=0.33 1/3.04 = 0.33 , the 24 hours together about 7.89, and the bound comes out at 3.04/24=0.13 3.04/24 = 0.13 (the output below, with three decimals, gives 0.127). Notice what i(λ)=1/λ i(\lambda) = 1/\lambda says: the bigger λ is, the less each hour informs. It makes sense: with a large λ the counts scatter more (the variance of the Poisson is λ) and each one pins λ down less well.

You can also get it with the first form, the one with the squared slope: E[(−1+Xλ)2]=E[(X−λ)2]λ2=Var(X)λ2=λλ2=1λ E\left[\left(-1 + \frac{X}{\lambda}\right)^2\right] = \frac{E\left[(X – \lambda)^2\right]}{\lambda^2} = \frac{\text{Var}(X)}{\lambda^2} = \frac{\lambda}{\lambda^2} = \frac{1}{\lambda} . Both forms give the same, as the definition promised. Use the one with the simpler derivative: here, the second, because the second derivative no longer has the −1.

Check you’ve got it: for the trip distance, normal with known σ = 0.7, what is the Fisher information for μ and the bound with 15 trips? Is the mean efficient?

The log-density is log⁡f=−log⁡(σ2π)−(x−μ)22σ2 \log f = -\log\left(\sigma\sqrt{2\pi}\right) – \frac{(x – \mu)^2}{2\sigma^2} . The first piece has no μ. Differentiating with respect to μ (chain rule: the 2 from the square cancels the 2 below, and the derivative of x−μ x – \mu is −1): x−μσ2 \frac{x – \mu}{\sigma^2} . Again: −1σ2 -\frac{1}{\sigma^2} , which no longer depends on x, so its expectation is itself. Changing the sign, i(μ)=1σ2=10.49 i(\mu) = \frac{1}{\sigma^2} = \frac{1}{0.49} , and the bound is σ2n=0.4915=0.03 \frac{\sigma^2}{n} = \frac{0.49}{15} = 0.03 . Since Var(Xˉ)=σ2/n \text{Var}(\bar X) = \sigma^2/n is exactly that, the mean is efficient in the normal too. Here the information does not depend on μ: moving the mean does not change how scattered the trips are.

And Var(Xˉ)=Var(X)n=λn \text{Var}(\bar X) = \frac{\text{Var}(X)}{n} = \frac{\lambda}{n} : it equals the bound, so Xˉ \bar X is efficient for λ. With our trips, replacing λ with its estimate:

lambda <- mean(trips); n <- length(trips)
round(c(lambda = lambda, var_mean = lambda / n, bound = lambda / n), 3)

Output:

  lambda var_mean    bound 
   3.042    0.127    0.127 

That is about 3.04 trips per hour, and both the variance of Xˉ \bar X and the bound are about 0.127 (trips per hour)². Careful: R has not “checked” anything here; we wrote the same formula twice, because theory says they are equal. The real check is to simulate. Take λ = 3 and n = 24, and compare the two unbiased estimators we had, Xˉ \bar X and S2 S^2 :

set.seed(24)
est <- replicate(10000, {
  x <- rpois(24, 3)
  c(mean = mean(x), sampvar = var(x))
})
round(rbind(mean     = rowMeans(est),
            variance = apply(est, 1, var)), 3)
3 / 24                                  # the Cramér-Rao bound with lambda = 3 and n = 24

Output:

          mean sampvar
mean     2.991   2.998
variance 0.123   0.929
[1] 0.125

How to read it

  • Row mean: 2.991 and 2.998, both around 3. Both unbiased, as theory said.
  • Row variance: 0.123 for Xˉ \bar X , which is the bound (0.125) with simulation noise; 0.929 for S2 S^2 , more than seven times as much.
  • The bound: 0.125. No unbiased estimator of λ with 24 hours can have less variance. Xˉ \bar X reaches it; S2 S^2 stays far away.
Two unbiased estimators of λ against the Cramér–Rao boundTwo bars with the simulated variance of two unbiased estimators of lambda in a Poisson with lambda 3 and 24 hours: the sample mean, 0.123, and the sample variance, 0.929. A dashed red line marks the Cramér–Rao bound, 0.125: the mean bar reaches it exactly and the sample variance bar goes far above it.0.000.250.500.751.00variance0.123X̄0.929S²bound = 0.125(λ = 3, n = 24)
X̄ touches the Cramér–Rao floor; S², also unbiased, varies more than seven times as much.

In the picture, each bar is the variance of an unbiased estimator and the dashed line is the Cramér–Rao floor. Xˉ \bar X touches the floor; S2 S^2 , though also right on average, wastes information.

Applying Cramér–Rao to the uniform(0, θ). The inequality needs the support (the possible values of X) not to depend on θ, and in the uniform it does. That is why the corrected maximum has a variance that falls like 1/n2 1/n^2 , much faster than any “bound” 1/n 1/n : it does not break the inequality; the inequality just does not apply to it.

Consistency

The previous properties look at a fixed n. Consistency looks at what happens when the sample grows. An estimator θ^n \hat\theta_n is consistent if, for every ε > 0,

P(∣θ^n−θ∣≤ε)→n→∞1 P\left(|\hat\theta_n – \theta| \le \varepsilon\right) \xrightarrow[n\to\infty]{} 1

That is, θ^n \hat\theta_n converges in probability to θ (θ^n→Pθ \hat\theta_n \xrightarrow{P} \theta ): with large samples, the estimator almost surely lands as close to the parameter as you like. It is the law of large numbers applied to estimators: Xˉ \bar X is consistent for the population mean.

Read aloud, the definition says three things:

  • Pick a distance ε, any you like: for example, 100 scooters.
  • Look at the probability that the estimator lands within that distance of the real fleet. With few scooters seen it can be low.
  • That probability has to go to 1 as n grows, and not only for 100: also for 10, for 1 or for the smallest distance you can think of.

It does not say the estimator is ever exactly right. It says that, after seeing enough scooters, missing by more than whatever you choose becomes as rare as you like.

Checking it with the definition can be hard. In practice you use this theorem:

E(θ^n)→n→∞θandVar(θ^n)→n→∞0⟹θ^n is consistent E(\hat\theta_n) \xrightarrow[n\to\infty]{} \theta \quad\text{and}\quad \text{Var}(\hat\theta_n) \xrightarrow[n\to\infty]{} 0 \quad\Longrightarrow\quad \hat\theta_n \text{ is consistent}

Two limits and you are done: the estimator must be (at least asymptotically) unbiased and its variance must go to 0. With the fleet, all three estimators satisfy the theorem: all three are asymptotically unbiased and their variances have n in the denominator.

Why two limits are enough

The theorem looks like a trick, but there is a one-line reason behind it. The probability of missing by more than ε is bounded by the MSE (it is Chebyshev’s inequality applied to the error):

P(∣θ^n−θ∣>ε)≤MSE(θ^n)ε2=Var(θ^n)+b(θ^n)2ε2 P\left(\lvert \hat\theta_n – \theta \rvert > \varepsilon\right) \le \frac{\text{MSE}(\hat\theta_n)}{\varepsilon^2} = \frac{\text{Var}(\hat\theta_n) + b(\hat\theta_n)^2}{\varepsilon^2}

If the expectation goes to θ, the bias goes to 0; if the variance also goes to 0, the MSE goes to 0, and so does the probability of missing, whatever ε is. The two conditions are exactly the two pieces of the MSE.

Applied to the fleet with ε = 100 scooters:

EstimatorExpectationVarianceGoes to 0?Why
2Xˉ 2\bar X θθ23n \frac{\theta^2}{3n} yesn in the denominator, and the bias is already 0
X(n) X_{(n)} nn+1θ→θ \frac{n}{n+1}\theta \to \theta nθ2(n+1)2(n+2) \frac{n\theta^2}{(n+1)^2(n+2)} yesdegree 1 in n on top and degree 3 below: it falls like 1/n2 1/n^2

In numbers, the Chebyshev bound for the maximum with n = 200 is 283.731002=0.03 \frac{283.73}{100^2} = 0.03 : it misses by more than 100 scooters at most 3 % of the time, and the simulation below gives 0 %. For 2Xˉ 2\bar X with n = 200 it comes out as 96001002=0.96 \frac{9600}{100^2} = 0.96 : the bound says almost nothing, and in the simulation it misses 31 % of the time. Chebyshev is a crude bound, but to prove consistency it does not need to be sharp: it is enough that it goes to 0.

Check you’ve got it: is S′2 S'^2 consistent for σ² in the normal?

Yes. The two conditions: its expectation is n−1nσ2 \frac{n-1}{n}\sigma^2 , which goes to σ² as n grows (it is asymptotically unbiased), and its MSE is (2n−1) σ4n2 \frac{(2n-1)\,\sigma^4}{n^2} , which has degree 1 on top and degree 2 below, so it goes to 0. Since the MSE is the variance plus the squared bias and both are positive, if the MSE goes to 0 so does the variance. Biased with small n, but consistent: that is what is asked of the maximum likelihood estimator.

But they do not all converge equally fast. Let us measure it: for several n, in 5000 samples, what proportion of the time does each estimator land within 100 scooters of the real fleet?

set.seed(7)
ns <- c(5, 12, 50, 200)
within <- sapply(ns, function(n) {
  s <- replicate(5000, {
    x <- runif(n, 0, 2400)
    c(moments = abs(2 * mean(x) - 2400) < 100,     # TRUE if it lands within 100
      maximum = abs(max(x) - 2400) < 100)
  })
  rowMeans(s)                                     # proportion of TRUE in each row
})
colnames(within) <- paste0("n=", ns)
within

Output:

           n=5   n=12   n=50 n=200
moments 0.1200 0.1988 0.3898 0.694
maximum 0.1972 0.4058 0.8798 1.000

How to read it

  • Each column is a sample size and each number is the proportion of the 5000 samples in which the estimator landed within 100 scooters: an estimate of P(∣θ^n−θ∣<100) P(|\hat\theta_n – \theta| < 100) .
  • The maximum: 0.20 with 5 scooters, 0.41 with 12, 0.88 with 50 and 1.000 with 200 (in the 5000 samples, not one was 100 scooters off). It goes to 1, as the definition requires.
  • 2X̄: it also rises (0.12, 0.20, 0.39, 0.69), but much more slowly. With 200 scooters seen it is still off by more than 100 scooters almost one time in three.
Probability of landing within 100 scooters as n growsTwo curves over n equal to 5, 12, 50 and 200, on a log scale. The maximum rises from 0.20 to 0.41, 0.88 and 1.00. 2X̄ rises more slowly: 0.12, 0.20, 0.39 and 0.69. A dashed green line marks 1.0.000.250.500.751.00scooters seen, n (log scale)P(|θ̂ − θ| < 100)512502000.120.200.390.690.200.410.881.002X̄maximum
Both are consistent (they climb towards 1); the maximum gets there much sooner.

In the picture, both curves climb towards 1: both estimators are consistent. The difference is the speed, and that speed is what the MSE measured. Being consistent is the least you ask of an estimator; being efficient is what makes it good with a real sample, which is never infinite.

An unbiased estimator need not be consistent. 2X1 2X_1 (keeping only the first scooter and doubling it) is unbiased for θ, but its variance is θ2/3 \theta^2/3 and does not fall with n: seeing more scooters does nothing for it.

The properties of the maximum likelihood estimator

Here is why the MLE is the star method. Under regularity conditions (the same as Cramér–Rao), the MLE θ^n \hat\theta_n satisfies:

  1. Invariance: if θ^ \hat\theta is the MLE of θ, the MLE of τ(θ) \tau(\theta) is τ(θ^) \tau(\hat\theta) . We used it in the previous topic.
  2. Consistency: θ^n→Pθ \hat\theta_n \xrightarrow{P} \theta .
  3. Asymptotic unbiasedness: E(θ^n)→θ E(\hat\theta_n) \to \theta . It can be biased with small n (like S′2 S'^2 or the maximum), but the bias goes away.
  4. Asymptotic efficiency: its variance approaches the Cramér–Rao bound. It is approximated with the curvature of the log-likelihood at the maximum:
Var(θ^n)≈−1ℓ′′(θ^) \text{Var}(\hat\theta_n) \approx -\frac{1}{\ell''(\hat\theta)}
  1. Asymptotic normality: for large n,
θ^n≈N(θ, 1n i(θ)) \hat\theta_n \approx N\left(\theta,\ \frac{1}{\sqrt{n\, i(\theta)}}\right)

(in the course notation, the second number is the standard deviation).

That the MLE is nearly normal with a variance you can compute is what will let us, in the next topic, build confidence intervals around it.

Trip duration

In the exponential, ℓ(λ)=nlog⁡λ−λ∑xi \ell(\lambda) = n\log\lambda – \lambda\sum x_i , the MLE is λ^=1/Xˉ \hat\lambda = 1/\bar X and the second derivative is ℓ′′(λ)=−n/λ2 \ell''(\lambda) = -n/\lambda^2 . So

Var(λ^)≈−1ℓ′′(λ^)=λ^2n \text{Var}(\hat\lambda) \approx -\frac{1}{\ell''(\hat\lambda)} = \frac{\hat\lambda^2}{n}

and its square root is the standard error of the estimate.

n <- length(duration)
lambda_ml <- 1 / mean(duration)
data.frame(lambda   = round(lambda_ml, 4),
           mean_min = mean(duration),
           asym_var = signif(lambda_ml^2 / n, 3),      # (lambda hat)^2 / n
           std_err  = round(sqrt(lambda_ml^2 / n), 4))

Output:

  lambda mean_min asym_var std_err
1  0.084    11.91 0.000352  0.0188

And when there is no formula, R gets it from the curvature with optim(…, hessian = TRUE):

loglik <- function(l) n * log(l) - l * sum(duration)
o <- optim(0.1, loglik, method = "Brent", lower = 0.001, upper = 1,
           control = list(fnscale = -1), hessian = TRUE)
data.frame(lambda   = round(o$par, 4),
           hessian  = round(o$hessian[1, 1], 1),       # l''(lambda hat)
           asym_var = signif(-1 / o$hessian[1, 1], 3))

Output:

  lambda hessian asym_var
1  0.084 -2837.8 0.000352

How to read it

  • lambda 0.084: an estimated 0.084 trips ending per minute, which is a mean duration of 11.91 minutes (the mean_min, 1/λ^ 1/\hat\lambda ).
  • asym_var 0.000352 and std_err 0.0188: if we repeated the 20 trips many times, λ^ \hat\lambda would move around λ with a standard deviation of about 0.019. Compared with 0.084, that is 22 %: with 20 trips, the estimate is a rough one.
  • hessian −2837.8: this is ℓ′′(λ^) \ell''(\hat\lambda) , the curvature of the log-likelihood at the peak. With fnscale = -1, optim maximises but returns the Hessian of the original function (negative, because it is a maximum). Its inverse with the sign changed, 1/2837.8=0.000352 1/2837.8 = 0.000352 , is the same asymptotic variance as the formula.
The curvature of the duration log-likelihoodTwo exponential log-likelihoods, shifted so that the maximum is 0, both peaking at lambda hat equal to 0.084. The 20-trip one, in violet, is a wide peak. The 80-trip one with the same mean, in coral, is much sharper and drops quickly on both sides.−8−6−4−200.040.060.080.100.120.140.16λℓ(λ) − ℓ(λ̂)λ̂ = 0.08420 trips (the real ones)80 trips, same mean
More data, sharper peak, more negative ℓ″ and smaller asymptotic variance.

In the picture, two log-likelihoods with the same maximum: the one for 20 trips and the one we would have with 80. With more data the peak is sharper, the second derivative more negative and the variance smaller. A sharp peak is a precise estimate; a flat peak, a shaky one.

λ^=1/Xˉ \hat\lambda = 1/\bar X is biased: E(λ^)=nn−1λ E(\hat\lambda) = \frac{n}{n-1}\lambda . With 20 trips, it overshoots by 5 %. The unbiased one is n−1nXˉ \frac{n-1}{n\bar X} . Both things, step by step, are in proof 7.

How I decide which estimator is better

Putting it all together, this is the order in which the properties are checked, and the tool for each:

The four questions to judge an estimatorFour cards in a row joined by arrows. 1, unbiasedness: is the expectation theta, or at least tending to theta? 2, MSE: variance plus squared bias, the smallest wins. 3, efficiency: is the variance the bound 1 over n times i of theta?, fixed support only. 4, consistency: the expectation tends to theta and the variance to 0. Below: with large n, the MLE meets 1, 3 and 4 asymptotically.1. UnbiasednessE(θ̂) = θ ?or at least E → θ2. MSEVar + b²the smallest wins3. EfficiencyVar = 1/(n·i(θ)) ?fixed support only4. ConsistencyE → θ, Var → 0both limitsWith large n, the MLE meets 1, 3 and 4 approximately (asymptotically).
The order in which the properties are checked, with the tool for each.
PropertyWhat it asksHow it is checked
Unbiasednessis it right on average?E(θ^)=θ E(\hat\theta) = \theta
Asymptotically unbiaseddoes the bias vanish with n?lim⁡E(θ^n)=θ \lim E(\hat\theta_n) = \theta
MSEhow wrong is it, overall?Var(θ^)+b(θ^)2 \text{Var}(\hat\theta) + b(\hat\theta)^2
More efficient (between unbiased)which varies less?ratio of variances
Efficientdoes it reach the floor?Var(θ^)=1n i(θ) \text{Var}(\hat\theta) = \frac{1}{n\,i(\theta)}
Consistentdoes it get closer as n grows?E→θ E \to \theta and Var→0 \text{Var} \to 0

What is proved in this topic

Each result has its full proof in the properties of estimators proofs:

ResultIdea of the proof
E(S2)=σ2 E(S^2) = \sigma^2 and the bias of S′2 S'^2 expand the sum and use E(X2)=σ2+μ2 E(X^2) = \sigma^2 + \mu^2
MSE=Var+b2 \text{MSE} = \text{Var} + b^2 add and subtract E(θ^) E(\hat\theta) ; the cross term is 0
Density, mean and variance of the uniform’s maximumP(X(n)≤x)=(x/θ)n P(X_{(n)} \le x) = (x/\theta)^n because they all have to land below
MSE of the three fleet estimators and their ratiothe formulas for the maximum and Var(Xˉ)=σ2/n \text{Var}(\bar X) = \sigma^2/n
MSE of S2 S^2 and S′2 S'^2 in the normal(n−1)S2/σ2∼χn−12 (n-1)S^2/\sigma^2 \sim \chi^2_{n-1} , with variance 2(n−1) 2(n-1)
Xˉ \bar X efficient in the Poisson and the normalFisher information compared with the variance
Bias, correction and asymptotic variance of the exponential MLE∑Xi∼gamma(n,λ) \sum X_i \sim \text{gamma}(n, \lambda) and E(1/Y) E(1/Y)

Common mistakes

  • Confusing the estimator with the estimate. 2Xˉ 2\bar X is an estimator (a random variable); 1979.33 is an estimate (a number). The properties belong to the estimator: “1979.33 is biased” makes no sense.
  • Forgetting to square the bias in the MSE: it is Var+b2 \text{Var} + b^2 , not Var+b \text{Var} + b . With a negative bias, without the square you would get an MSE smaller than the variance, or negative.
  • Comparing variances of biased estimators. To choose between a biased and an unbiased one, compare MSEs.
  • Calling the one with smaller variance of two “efficient”. “More efficient than another” compares two; “efficient” means reaching the Cramér–Rao bound.
  • Forgetting the n in the bound: it is 1/(n i(θ)) 1/(n\,i(\theta)) , with i(θ) i(\theta) the information of one observation.
  • Using Cramér–Rao when the support depends on θ (uniform(0, θ) and the like).
  • Proving consistency with the expectation only. Besides E→θ E \to \theta , you need Var→0 \text{Var} \to 0 .

Try it in the R playground

Paste this script into the R playground and run it all. It repeats the fleet simulation with another sample size:

set.seed(1)
theta <- 2400; n <- 30            # change n and run it again
sims <- replicate(5000, {
  x <- runif(n, 0, theta)
  c(moments = 2 * mean(x), maximum = max(x), corrected = (n + 1) / n * max(x))
})
bias <- rowMeans(sims) - theta
mse  <- rowMeans((sims - theta)^2)
round(rbind(bias = bias, mse = mse, root_mse = sqrt(mse)), 1)
par(mfrow = c(1, 3))
for (k in 1:3) {
  hist(sims[k, ], breaks = 40, main = rownames(sims)[k], xlab = "scooters")
  abline(v = theta, col = "red", lwd = 2)
}

What to look at:

  1. In the Environment tab, sims is a 3 × 5000 matrix: one row per estimator.
  2. The bias of the maximum: with n = 30 it should be around −2400/31≈−77 -2400/31 \approx -77 .
  3. The root_mse row, in scooters: compare it with the n = 12 values in this article.
  4. In Plots, the three histograms with the red line at 2400: the maximum’s never crosses it.
  5. Try n = 3: the corrected maximum stays centred, but all three histograms get wider.

Summary

ConceptDefinitionWith the fleet
Biasb(θ^)=E(θ^)−θ b(\hat\theta) = E(\hat\theta) – \theta the maximum: −θ/(n+1) -\theta/(n+1)
UnbiasedE(θ^)=θ E(\hat\theta) = \theta 2Xˉ 2\bar X and n+1nX(n) \frac{n+1}{n}X_{(n)}
Asymptotically unbiasedE(θ^n)→θ E(\hat\theta_n) \to \theta the maximum, S′2 S'^2
MSEVar(θ^)+b(θ^)2 \text{Var}(\hat\theta) + b(\hat\theta)^2 the corrected maximum wins
Cramér–Rao boundVar(θ^)≥1/(n i(θ)) \text{Var}(\hat\theta) \ge 1/(n\,i(\theta)) Xˉ \bar X reaches it in the Poisson
Consistentθ^n→Pθ \hat\theta_n \xrightarrow{P} \theta all three; the maximum, much faster
MLE, for large nθ^n≈N(θ,1/n i(θ)) \hat\theta_n \approx N\left(\theta, 1/\sqrt{n\,i(\theta)}\right) duration: standard error 0.019

Three ideas to take away:

  1. An estimator is a random variable: it is judged by its distribution (where it is centred and how much it scatters), not by the number it gave with your sample.
  2. The MSE adds variance and squared bias. Sometimes a little bias pays off (S′2 S'^2 ); sometimes removing it is very cheap (the corrected maximum).
  3. The Cramér–Rao bound is the floor for unbiased estimators, and the MLE reaches it as n grows. Its curvature tells you how much to trust it.

Now it is time to prove it: the properties of estimators proofs have each result step by step. Then, in the properties of estimators practice, you will simulate it all in R, with its plots. And to check you have got it, the properties of estimators exercises are chained exam-style exercises with commented solutions.

Next step: proofsProperties 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)

Did this article help you? Here is how you can support SergioLearns →