ExplorationsShrinking unrelated estimates towards nothing in particular

Three Guesses Beat One

Provedstatisticsestimationnormal distributionintermediate

Suppose three measurements have independent, zero-centred normal errors, each with 1. The James–Stein formula adjusts them together. For measurements 4, 3 and 0, square and add them to get 25, then multiply each measurement by 1 − 1/25 = 24/25, giving 3.84, 2.88 and 0. This lowers the average total over repeated measurements, whatever the true values are, but it can make an individual trial worse. The applies in three or more dimensions.

Current view: One trial

A single measurement, the truth behind it, and where the estimator moved it to.

One trial · 3 quantities, 1 trialseed 20,260,828
targettruthmeasuredshrunken

The factor, with this trial’s numbers in it1 − (3 − 2) × 1 ÷ 13.768 = 0.927

  • ‖x − θ‖² = 4.575
  • ‖ĵ − θ‖² = 3.969

In 3 dimensions the dimension minus two is 1, so the factor falls below 1 whenever the measurement is far enough from the target, and every coordinate moves towards it. On this trial the shrunken estimate is the closer of the two, and on plenty of other trials it is not. One trial settles nothing about either estimator, which is why there is a race view beside this one and a theorem beneath it.

This trial, coordinate by coordinate
Trial 1: the true mean, the measurement drawn from it, and the shrunken estimate, one row per coordinate
CoordinateTrue valueMeasuredShrunken estimateMoved by
11.7321.2031.116−0.087
21.7320.5880.545−0.043
31.7323.4603.209−0.251
the target
the point every estimate is pulled towards, which is zero here
the truth
the true mean the measurement was drawn from
the measurement
the single noisy observation of that mean
the shrunken estimate
the measurement multiplied by the factor, on the line towards the target
the move
how far the estimator shifted the measurement on this trial

Four things in one plane: the target being shrunk towards at the centre, the true mean, the measurement drawn from it, and the shrunken estimate on the line between the measurement and the target. That plane is not a projection that loses anything, because those four points genuinely lie in a plane whatever the dimension. The two lines to mark are the ones running from the true mean: one to the measurement, one to the estimate. Their squared lengths are the two losses being compared, and on any single trial either may be the shorter.

Trial 1 of 1 at seed 20,260,828: the shrinkage factor is 0.927, the measurement lost 4.575 and the shrunken estimate lost 3.969, so the shrunken estimate is the closer of the two on this trial. One trial is a story about one draw and settles nothing about either estimator.

Trial
1 / 1
Factor
0.927
Measurement
4.575
Shrunken
3.969

How many quantities at once

One trial at a time

Use Step for one change you can inspect, or Run to watch the changes accumulate.

Speed

The experiment

How many trials

One measurement, with the factor written out and both squared errors drawn as lengths.

Advanced parameters

Cases worth seeing

Try this

Stay in the single-trial view and step through twenty trials, watching which of the two lines from the true mean is shorter each time. How often does the shrunken estimate lose an individual trial, and how can it be ahead on average anyway?

1/4

What is going on

Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.

Worked by handOne trial in three dimensions, at the seed the laboratory opens with: three true values, one noisy measurement of each, the with those measurements substituted, and the two compared. Every number is the laboratory's own, rounded to three places for printing, so a sum checked by pencil may differ in the last digit.
  1. θ₁ = 1.7321.732 + (−0.529)x₁ = 1.203the first quantity, measured once, with noise of 1
  2. θ₂ = 1.7321.732 + (−1.144)x₂ = 0.588the second, which the noise pulled well below the truth
  3. θ₃ = 1.7321.732 + 1.728x₃ = 3.460the third, pushed almost as far above it
  4. x1.203² + 0.588² + 3.460²‖x‖² = 13.768the squared length of the measurement, which is all the looks at
  5. ‖x‖² = 13.7681 − (3 − 2) × 1 ÷ 13.768factor = 0.927below 1 because the dimension is above 2, and by that much because x is this long
  6. x0.927 × (1.203, 0.588, 3.460)ĵ = (1.116, 0.545, 3.209)every moved 7.3 per cent of the way towards zero
  7. x(1.203 − 1.732)² + (0.588 − 1.732)² + (3.460 − 1.732)²‖x − θ‖² = 4.575what reporting the measurements themselves cost on this trial
  8. ĵ(1.116 − 1.732)² + (0.545 − 1.732)² + (3.209 − 1.732)²‖ĵ − θ‖² = 3.969what the shrunken estimate cost, on this trial and on no other

The laboratory draws exactly this. The target sits at the centre, the true mean and the measurement are two points around it, and the shrunken estimate is the measurement slid along the line towards the target by the computed on the fifth line. The two lines running from the truth are the last two rows of the plate, drawn as the lengths they are.

On this trial the shrunken estimate came out closer. That is worth almost nothing on its own, and the interesting part is which of the three paid for it: the estimate moved every coordinate, including the two that were already about right, and it decided how far to move them from a single number that mixes all three together. The three quantities never had anything to do with one another, and the treated them as though they did.

01

What you are seeing

A plain description of the process

There are three quantities you want to estimate, written . The model gives one measurement of each, , by adding independent, zero-centred normal errors with the same known . An individual error is not known; the variance describes its distribution over repeated measurements. The uses these assumptions, so it does not apply automatically to unrelated real-world measurements with different units or error scales.

The obvious estimate of is , and the obvious estimate of the three together is . Score a set of guesses by the total , which is the squared distance from the guesses to the truth.

Now do something that ought to be pointless. Compute one number from all three measurements at once,

where is how many quantities there are, is the size of the noise on each, and is the sum of the squares of the three measurements. Then multiply all three guesses by that . For example, with three measurements 4, 3 and 0 and 1, the factor is 1 − 1/25 = 24/25, giving adjusted estimates 3.84, 2.88 and 0. If the squared length is very small, the ordinary formula can instead produce a negative factor and move past zero. The positive-part version clips that factor at zero; the laboratory shows both versions.

The total of the pulled-in guesses is smaller, on average, than the total squared error of the measurements. Not for a lucky choice of the true values: for every choice of them. And the pulling towards zero is not because zero is a good guess. It works pulling towards any you like, chosen before you look at the data.

At three quantities it works. At one or two it does not, and the same formula says why: the in it is negative at , zero at , and only becomes positive at . Those are the failure presets on this page, and they are not accidents of the simulation.

02

Why it starts to make sense

Intuition, before any algebra

The first thing to give up is the idea that the knows anything about the three quantities being related. It does not, and they are not.

Here is the trade being made. Multiplying a guess by a slightly below 1 introduces a : the guess is now systematically a little short of the truth. In exchange it reduces the , because a shrunken random quantity varies less. is bias squared plus variance, so shrinking is worth doing exactly when the variance saved exceeds the bias bought.

For one quantity, that trade is never worth it in the way you would need. You do not know which direction the truth lies in, so shrinking towards zero helps when the truth is near zero and hurts when it is far away, and there is no way to choose the from the data that wins everywhere.

The second thing to notice is what happens to a length in several dimensions. If each measurement error has , then the squared distance from the measurement to the truth has average . It grows with . But something else grows too: , the squared length of the measurement, comes out on average around , which is systematically larger than . The measurement is reliably too long. Not in any particular direction, which would be a you could correct, but in length, which is a bias in a quantity that all contribute to.

That is the whole mechanism. The measurement is too long by an amount you can estimate, because separate each contribute their to its length, and correcting the length is one correction learned from pieces of evidence. One coordinate cannot tell you its own error. Three coordinates can tell you, collectively, roughly how much error there is in total, and that collective knowledge is what gets spent.

Why three and not two? Because the correction has to be paid for. Shrinking the length costs you accuracy in the direction the points, and that cost does not shrink with dimension, while the saving does. The formula sets the exchange rate at , and below three dimensions there is nothing left over.

03

The key idea

What this page can and cannot settle

Two sentences carry this page, and they point in opposite directions.

The result is a . In three or more dimensions, the shrunken has strictly smaller expected than the measurement, at every possible true mean. Stein proved this in 1956 and James and Stein gave the explicit estimator in 1961.

This page has not shown you that. Everything on it is a finite number of draws around one true mean at one seed. A simulation samples finitely many true means, finitely often, and the statement above is quantified over all of them.

Those two live together uncomfortably and that is the point of putting them next to each other. The race view separates, convincingly, and would separate just as convincingly if the happened to be false at some true mean the simulation never visits. The picture is consistent with the theorem. It is not evidence for it, in the ordinary sense that evidence is something which would have come out differently had the claim been wrong.

There is a good reason this page still runs the simulation. What a simulation is genuinely good at is showing you the mechanism: one trial at a time, you can watch the being computed from the measurement's own length, watch every move by the same proportion, and watch the shrunken estimate lose about a third of the individual trials while winning the average. None of that is available from reading the statement, and none of it is an argument.

And there is a third thing the laboratory does that the does not. It shows what the theorem looks like when it is true and invisible. Set the dimension to ten and move the truth out to fifty units from the target: the improvement is still there, still at every true mean, and too small for any figure at that scale to render. A reader who judged by the picture would call it a tie. That is worth more than another convincing separation, because it is the case where trusting the figure over the statement would give you the wrong answer.

04

Formal statement

Precisely what is being claimed

Let with known, and score an by its risk, the expected

Write for the measurement itself, and for a fixed chosen in advance,

  1. for every . Proved, in layer 5.
  2. For and every , . Proved by Stein and by James and Stein, cited here. The deduction from their risk identity is one line and is given in layer 5; the identity itself is not derived on this page.
  3. For , is admissible: no has risk at most at every with strict inequality somewhere. Proved by Blyth for , and recorded by Stein as the reason three is the threshold. Cited, not reproduced.
  4. The exceeds 1 when , equals 1 exactly when , and is below 1 when and . Proved, in layer 5, in one line.
  5. , the same with the replaced by , has for every when . Proved by Baranchik, cited.
  6. The mean printed by the laboratory are what they are at the seed, dimension, true mean and trial count shown. Observed. They are not evidence for statement 2, and no number of trials would make them so.

Statement 2 is the subject. Statement 6 is what this page produces. The distance between those two rows of the ledger is the reason the page exists.

05

Proof

Of the two short statements, and the one line that follows from a cited identity

The risk of the measurement. The of are independent with mean zero and , so

for every . It does not depend on at all, which is why the plain 's mark in the dimensions view lies on a straight line through the origin. ∎

The sign of the . The factor is , and and . So the sign of the subtracted term is the sign of . At that is , so the subtracted term is negative and the factor is : the estimate is pushed away from . At it is , so the factor is exactly and identically, not approximately. At it is positive, so the factor is below 1, and it is additionally non-negative precisely when . ∎

Why , from the risk identity. Take without loss of generality. James and Stein compute the risk of exactly:

That identity is cited and not derived here; it follows from Stein's integration-by-parts lemma for the . Granted it, the conclusion is one line. For the quantity is finite and strictly positive, and , so the subtracted term is strictly positive and for every . ∎

And why the same line does not work below three. It is tempting to read the identity at , notice that is still positive, and conclude that shrinking wins there too. It does not, and the reason is the . For , is infinite: the normal density does not vanish at the origin, and is not integrable against it in one or two dimensions. The identity has no content there, and the laboratory shows what actually happens instead, which is that the is much worse.

What is not proved here. Statements 2, 3 and 5 of layer 4, in the sense that matters: the risk identity above, the admissibility of the measurement in one and two dimensions, and Baranchik's improvement are all taken from the literature. This page can substitute numbers into a formula and average the results, and that is a different activity from establishing any of them.

06

Limits and frontier

Where this page stops being able to help

What this laboratory computes. Up to ten quantities at once and up to ten thousand trials, with the noise on each having exactly 1. The measurements come from a seeded generator: uniform values from a 32- generator, turned into normal ones by Box and Muller's transform. Nothing here uses the browser's own randomness, so the address bar reproduces a run exactly, and the seed is written into it even when it is the default one.

What the numbers on the page are. Observations, in the strict sense the ledger uses. Every printed here is an average over finitely many draws around one true mean, and it is reported as a property of that run. The seed makes it checkable. It does not make it general.

Where the figures stop being able to show the truth. At ten dimensions with the true mean fifty units from the target, the improvement is real, is guaranteed by the , and is smaller than the width of a line. The dimensions view has the same problem at in the other direction: the shrunken 's mean loss is many times the plain one's, so it is drawn as an arrow at the top of the plot and the number is left to the table. Both are cases where the figure cannot carry what is true, and saying so is cheaper than redesigning the figure to hide it.

What is left open. Not the , which is seventy years settled. What remains genuinely difficult is everything about using it: which point to shrink towards when you have no reason to prefer one, how to report an uncertainty for an estimate that borrowed strength from unrelated quantities, and what to say to somebody who only cares about the beetle and is being told that the best guess for its length depends on the price of tin. The improvement is in the total across all the quantities, and a reader who wants a guarantee about one of them separately does not get it from any of this.

Read this next to Every Even Number, Two Primes. There, a search never fails and the is open, so the computation is evidence for something unproved. Here, the is settled and the computation is evidence for nothing at all. Two pages of convincing pictures, and the pictures are doing entirely different work.

What is actually established

Every statement on this page, with its status, its exact scope, and the date that status was last checked.

Proved

In three or more dimensions the James-Stein estimator has strictly smaller expected squared error than the measurement itself, at every possible true mean.

Scope
Every true mean in every dimension from three upwards, for independent normal coordinates with a known common variance. Proved by Stein in 1956 and given explicitly by James and Stein in 1961. Illustrated by this page and established by none of it.
Why
This is the statement the page exists to introduce and the one thing on it that no amount of simulating could reach. It is quantified over every mean: there is no true value, however chosen, at which the plain estimator does better in expectation. A simulation draws finitely many observations around finitely many means, so the most it can report is what happened at those. The relationship between the figure and the theorem runs one way only, and the figure is the illustration.
Status checked
Proved

In one and two dimensions the measurement itself cannot be beaten: no estimator has smaller expected squared error at every true mean.

Scope
Dimensions one and two, for the same normal model. The one-dimensional case is Blyth in 1951 by a limiting-Bayes argument; Stein records that two behaves the same way and that three is where it changes.
Why
Worth stating beside the first claim because it turns the failure presets from disappointments into content. When the laboratory is set to one or two dimensions and nothing improves, that is not the simulation being unlucky or the estimator being badly implemented: improvement is impossible there, and the impossibility is a theorem. The number three is not a threshold beyond which the trick starts working well. It is the first dimension in which it can work at all.
Status checked
Proved

The shrinkage factor is greater than 1 in one dimension, exactly 1 in two, and less than 1 whenever the dimension is at least three and the measurement is far enough from the target.

Scope
Every observation and every dimension, as a statement about the formula rather than about any run. Proved in one line from the sign of the dimension minus two.
Why
The factor is 1 minus the quantity (d − 2)σ² divided by the squared distance from the target. That quantity is negative at d = 1, so the factor exceeds 1 and the estimate is pushed away; it is zero at d = 2, so the factor is exactly 1 and the estimate is the measurement, unchanged, not merely close to it; and it is positive from d = 3, so the factor falls below 1. Everything the failure presets show is this one sign, read at three values of one integer, and it is arithmetic rather than evidence.
Status checked
Proved

Clipping the shrinkage factor at zero gives an estimator with smaller expected squared error than the unclipped one, at every true mean.

Scope
Every true mean in dimension three or above, under the same model. Proved by Baranchik in 1964, cited here and not reproduced.
Why
When the measurement lands close to the point being shrunk towards, the factor goes negative and the unclipped estimate is thrown through the target and out the other side, which is visibly the wrong answer: the data said "near the target" and the estimator replied "far from it, in the opposite direction". Clipping at zero fixes that, and the fix is a strict improvement rather than a tidy-up. This laboratory computes both and reports the clipped one alongside, where the difference shows up mainly in small runs and near a mean of zero.
Status checked
Proved

The expected squared error of reporting the measurement is exactly the dimension times the variance of one coordinate.

Scope
Every true mean, every dimension. A one-line consequence of each coordinate contributing its own variance and nothing else.
Why
This is the straight line the dimensions view is drawn against, and it is useful as a check on the machinery rather than as a result: the coordinates are independent, each contributes its variance to the expected squared distance, and the total is the dimension times that variance. With the variance fixed at one, the plain estimator should average close to the dimension itself, and when it does not, the noise is the wrong size rather than the estimators behaving unusually.
Status checked
Observed in this run

At the seed, dimension, true mean and trial count currently shown, the mean squared errors are the two numbers in the readout, and their difference is a property of that run.

Scope
One seed, one true mean, and however many draws the trial control is set to. Nothing outside that run, and in particular no other mean and no other seed.
Why
Every number this page produces belongs in this row and no other. A simulation samples finitely many true means, finitely often, so it cannot speak about a claim quantified over all of them: the numbers here are consistent with Stein’s theorem and are not evidence for it, and would look much the same if the theorem were false in some case the run never visits. Two things are reported beside the averages to keep that visible. The first is how many individual trials the shrunken estimate lost, which is always a substantial share and sometimes most of them at small dimensions. The second is that the run is reproducible: the seed is in the address bar, so the same link gives the same numbers to the digit, which makes the result checkable and no more general.
Status checked

Sources

Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.

  1. Charles Stein, Inadmissibility of the usual estimator for the mean of a multivariate normal distribution, Proceedings of the Third Berkeley Symposium on Mathematical Statistics and Probability 1, pp. 197–206, 1956. Link

    Where the result appears. Stein shows that in three or more dimensions the obvious estimator of a normal mean is inadmissible: some other estimator has smaller expected squared error at every possible true mean, with no case where it does worse. Cited for the theorem itself and for the fact that dimensions one and two are different, neither of which this page establishes.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    University-hosted original confirms author, title and Berkeley symposium paper.

  2. W. James, Charles Stein, Estimation with quadratic loss, Proceedings of the Fourth Berkeley Symposium on Mathematical Statistics and Probability, 1961. Link

    The explicit estimator, and the calculation of its risk. This is the source of the formula the laboratory evaluates, factor and all, and of the fact that its expected loss is below that of the observation at every mean once the dimension reaches three. Cited rather than reproduced: the page substitutes numbers into the formula and never derives the risk.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    University-hosted original confirms both authors and the estimator paper.

  3. Colin R. Blyth, On minimax statistical decision procedures and their admissibility, The Annals of Mathematical Statistics 22(1), pp. 22–42, 1951. Link

    Develops admissibility arguments using limits of Bayes procedures. This bibliographic check is not a rederivation of the one- and two-dimensional normal-mean results.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    The journal contents confirm the author, title, publication date and pages.

  4. Alvin J. Baranchik, Multiple regression and estimation of the mean of a multivariate normal distribution, Technical Report 51, Department of Statistics, Stanford University, 1964. Link

    Studies normal-mean estimation, including the positive-part improvement. Clipping the shrinkage factor at zero improves total expected squared error; it does not guarantee a better estimate in every individual trial.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Issuing department confirms author, title, report CHE ONR 51 and May 1964.

  5. Bradley Efron, Carl Morris, Stein's paradox in statistics, Scientific American 236(5), p. 119, 1977. Link

    The exposition that made the result widely known, and the source of the batting-average example most readers meet first. Cited as a place to go next rather than for any statement here. It is also where the discomfort is put best: the estimator improves a set of unrelated quantities by making each of them depend on all the others, and the improvement is in total squared error rather than in any single one.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Publisher confirms both authors, May 1977, volume 236(5), starting page 119.

  6. G. E. P. Box, Mervin E. Muller, A note on the generation of random normal deviates, The Annals of Mathematical Statistics 29(2), pp. 610–611, 1958. Link

    Transforms two independent continuous uniform variables into two independent standard normal variables. The laboratory uses finite-precision arithmetic and a seeded pseudorandom generator, so its simulated draws approximate that ideal model.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: library record.

    National academic record confirms both authors, June 1958 and volume 29(2), pages 610–611.

Connected by how they work, not by sharing a topic label.