Take 4 points, average them, and fire the average at a target. Repeat 500 times, and watch where the shots land.
Off-centre or scattered
Estimating the centre (1, 1) of a round bell from 4 points, 500 times (seed 6200).
Estimator A: the average of each coordinate of 4 points. Each repeat takes a new sample and fires one shot.
Describe this picture
Three panels that stay apart, side by side on a wide screen (on a phone, the first two above the third). The first, “the population”, is a round two-dimensional bell centred on a bull’s-eye at (1, 1), with spread 1 in each direction, drawn as shading that fades outward. The second, “one sample”, shows 4 points drawn from it and the estimate made from them, a ring labelled “estimate”. The third, “500 repeats”, shows the estimates from 500 seeded samples (seed 6200) as shots on a target. The clip runs two estimators in turn. Estimator A, the average of each coordinate, puts its shots in a cloud centred on the bull’s-eye. Then every shot is pulled 20 % towards (0, 0): estimator B, that average times 0.8, a tighter cloud centred at (0.8, 0.8). Readouts give the shrink factor and the mean squared distance from the shots to the bull’s-eye with its two parts, bias squared and variance, as measured: A 0.0009 + 0.5283 = 0.5292, B 0.0831 + 0.3381 = 0.4212. After the clip a slider, “Shrink factor c”, sets from 0.5 to 1.2 in steps of 0.05; the shots move, the readouts follow, and the caption gives the exact parts beside the measured ones.
An estimate is a draw
Somewhere there is a true value I want: the bull’s-eye. I only see a sample, and from it I compute a number that I hope is close. The true value is a parameter, written ; the rule that turns a sample into a guess is an estimator, written . The hat means “estimated”.
The middle panel shows one sample and one estimate. Draw a new sample and you get a new estimate: an estimator is a random variable, with its own distribution over repeated samples. The third panel draws that distribution, and it is a different thing from both the population and the one sample. Keep the three apart.
Each coordinate of estimator A is the average of 4 draws with standard deviation 1. As in The law of large numbers, such an average has standard deviation . So A’s shots scatter about 0.5 each way around the bull’s-eye. B’s shots are A’s times 0.8: they scatter only 0.4 each way, but around .
Which is better? A is right on average but scattered. B is off-centre but tight. The readouts say B lands closer, on average: a mean squared distance of 0.4212 against A’s 0.5292, close to the exact 0.40 and 0.50.
Bias, variance and their sum
Two numbers describe an estimator’s cloud of shots. Its bias is how far the centre of the cloud is from the truth:
Its variance is how widely the shots scatter around their own centre. An estimator with bias 0 is unbiased.
What I care about is how far the shots land from the truth. The mean squared error measures it:
Write as : a scatter part with mean 0, plus the fixed bias. Square and take the mean. The cross term has a factor with mean 0, so it drops out:
For one coordinate of the target: A has bias 0 and variance , so its MSE is . B has bias and variance , so its MSE is . The target adds the two coordinates, so its readouts are twice these: for A, and for B.
Why divide by
Describing data divided the squared deviations by to get . Here is an exact count that shows why.
Why divide by n − 1
Every sample of two from 0, 3 and 6, and the two ways to average their spread.
Draw two values from 0, 3 and 6, with replacement: nine samples in all, each with its sum of squared deviations from its own mean.
Predict first. Over all nine samples, what does "divide by n" average to?
Describe this picture
The population is the three numbers 0, 3 and 6, each equally likely: mean 3, variance 6. All nine samples of two values, drawn with replacement, are listed in a small table with their sums of squared deviations from their own mean: 0, 4.5, 18, 4.5, 0, 4.5, 18, 4.5, 0. Before the clip a question asks what the average of “divide by ” will be over the nine samples: 6, 3 or 4.5. A tap picks one and starts the clip. In the clip the nine values drop as dots onto two rows on one scale from 0 to 20, with a dashed line at the true variance, 6: divided by 2 they average 3; divided by 1 they average 6, the true variance. Your guess is then drawn as a dotted marker on the first row. Readouts give the two averages and the true variance. There is no control after the clip.
The sum of squared deviations averages 6 over the nine samples. Divide it by and the estimate averages 3, half the truth. Divide by and it averages 6, exactly the truth.
The reason holds for every sample size. The deviations are measured from the sample’s own mean , which sits in the middle of the sample and so is closer to the points than the true mean is. Exactly how much closer is an identity:
Here the are the draws as random variables, before the sample is seen. Take means. The first sum has mean . The average has variance , so the last term has mean . What is left is , so
With divisor the mean is , a bias of . For that is .
Watch out
The divisor is not a convention. It makes right on average. But “right on average” is only one way to judge an estimator, as the next section shows.
Shrinking: a little bias for less scatter
Estimator B multiplied the average by a shrink factor , here 0.8. In general, for the average of draws,
The first term is the variance, which shrinks with ; the second is the bias squared, which grows as moves away from 1. Their sum is smallest at
For the target, , and , so the best factor is . After the clip, drag and watch the total: at , at , at 1 and at , a U with its bottom at 0.8.
There is a catch. The best depends on , the very thing being estimated. In practice it is chosen from earlier data or a rule, and the gain is real only when the guess is reasonable. The lesson stands, though: an unbiased estimator is not always the best one.
Consistency
An estimator is consistent if it settles on the truth as the sample grows; an MSE that falls to 0 is enough to show it. The average is unbiased with variance , so its MSE falls to 0. With and it is already .
Worked example
1. The nine samples. Over the nine samples the divisor- estimate averages , which is , half the truth. The divisor- estimate averages .
2. Shrinking a mean. With , and , the average has MSE . The estimate has bias , variance and MSE .
3. Three divisors for a variance. Take bell-shaped data with and , and divide the sum of squared deviations by 4, 5 or 6:
| Divisor | Bias | Variance | Mean squared error |
|---|---|---|---|
| 4 | 0 | 0.5 | 0.5 |
| 5 | −0.2 | 0.32 | 0.36 |
| 6 | −0.3333 | 0.2222 | 0.3333 |
The unbiased divisor, 4, has the largest error. Dividing by 6 is biased low but lands closest on average. Which one to use depends on what you need: right on average, or close on average.
Where you’ll meet this
Calibration. A sensor is calibrated by averaging repeated readings of a known reference; the bias of the average is the calibration error, and its variance falls as .
Regression. Shrinkage estimators such as ridge regression pull fitted coefficients towards zero: a little bias for much less scatter, the trade of the target.
Experiments. Every A/B test reports an estimate, and its standard error is the square root of the estimator’s variance, the subject of Confidence intervals.
In signal processing · bias and variance of a spectrum
The periodogram estimates a spectrum, and more data does not steady it: its variance does not shrink, so it is not consistent. Averaging segments trades resolution, a bias, for less variance. The periodogram and Averaged periodograms: Bartlett and Welch in the signal processing course make the trade.
Where this leads · ridge is shrinkage
Ridge regression adds a penalty that shrinks the solution towards zero, the matrix form of the factor . The pseudo-inverse in the linear algebra course shows the algebra.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Estimator | , a function of the sample | a random variable |
| Bias | 0: unbiased | |
| Mean squared error | ||
| Sample variance | with divisor | divisor : |
| Shrinking the mean | best | |
| Consistent | MSE falls to 0 as grows | : |