Search

Search papers and lessons

MMSE Estimation

Level 3 · 15 min read

The best estimate of a hidden quantity from noisy data is its conditional expectation given the data, the guess with the smallest average squared error.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Linear algebra
  • Calculus
  • Losses & regularization
  • Inference
  • Sign in to see your progress

TL;DR

You want to know a hidden number, such as the true temperature of a room, but all you have is a noisy reading. Any guess you make will be wrong by some amount. The minimum mean square error (MMSE) estimate is the guess that makes the average squared wrongness as small as possible. It turns out to be the conditional expectation of the hidden number given the reading: the average of every value that is still possible once you have seen the data.

When the hidden number and the noise are both Gaussian, that best guess is a simple weighted average of the prior guess and the reading, with more weight on whichever source is more reliable.

Where you'll see it: in the Kalman filter that tracks a rocket or a phone's position from noisy sensors, in signal denoising (the Wiener filter), and in the posterior mean that Bayesian models report as their point estimate.

Intuition

Guessing a hidden number

Suppose a friend has picked a secret number and you have to name it. You get one clue: a noisy hint that is the secret plus or minus some random error. What single number should you say?

Two obvious choices come to mind. You could repeat the hint, or you could ignore the hint and say the average secret you would expect before any clue. The right answer sits between them, and exactly where depends on how noisy the hint is. A reliable hint should pull your guess strongly toward it. A useless hint should barely move you from the prior average.

MMSE gives a precise rule for "exactly where". It asks: among all rules that turn a hint into a guess, which one makes the average squared error smallest? Squared error is used because it punishes a big miss much more than several small ones, and because it has a clean mathematical answer.

Why the answer is an average

Once you have seen the hint, some values of the secret are no longer possible, and the rest are not all equally likely. Your best single guess is the average of the values that remain, weighted by how likely each one is. That average is the conditional expectation. Any other single guess is, on average over many repeated experiments, further from the truth in squared terms.

−4−2024−4−2024hint (the noisy reading y)guess for the hidden value
  • MMSE rule: guess = 0.8 × hint
  • trust the hint completely
For one simple setup (worked out below), the best guess is a straight line through the origin with slope 0.8. The guess always shrinks the hint toward zero. Markers show the guesses for hints 2.5 and −1.

The picture shows the central fact of the lesson. The best guess is not the hint itself. It is the hint pulled toward the centre of what you expected, by an amount set by the noise.

flowchart LR
  X[Hidden value X] --> N((+ noise))
  N --> Y[Reading Y]
  Y --> G[Estimator g of Y]
  G --> E[Error X minus g of Y]
  E --> S[Average of squared error]

The math

Setting up the problem

Let XX be the hidden quantity, a random variable we cannot see. We observe a second random variable YY that carries information about XX, usually XX plus noise. An estimator is any rule gg that turns the observation into a guess X^=g(Y)\hat{X} = g(Y). The mean squared error of that rule is

MSE(g)=E[(X−g(Y))2].\mathrm{MSE}(g) = \mathbb{E}\left[\left(X - g(Y)\right)^2\right].

The expectation E\mathbb{E} averages over both the randomness in XX and the randomness in the noise. The MMSE estimator is the rule gg that makes this as small as possible. (For the squared-error background, see Mean Squared Error.)

The answer: conditional expectation

Definition: MMSE estimator

The minimum mean square error estimator of XX given YY is

X^MMSE=E[X∣Y],\hat{X}_{\text{MMSE}} = \mathbb{E}[X \mid Y],

the conditional expectation of XX given the observed value of YY. No other rule has a smaller mean squared error.

Here E[X∣Y]\mathbb{E}[X \mid Y] is a function of YY: plug in the value you observed and it returns the average of XX over all cases consistent with that observation.

Why is this the minimum? Write m(Y)=E[X∣Y]m(Y) = \mathbb{E}[X \mid Y] and let gg be any other rule. Split the error into two pieces:

X−g(Y)=(X−m(Y))+(m(Y)−g(Y)).X - g(Y) = \bigl(X - m(Y)\bigr) + \bigl(m(Y) - g(Y)\bigr).

Square both sides and take the expectation. The cross term E[(X−m(Y))(m(Y)−g(Y))]\mathbb{E}\left[\left(X - m(Y)\right)\left(m(Y) - g(Y)\right)\right] is zero. To see this, condition on YY: the factor m(Y)−g(Y)m(Y) - g(Y) is fixed once YY is known, and E[X−m(Y)∣Y]=0\mathbb{E}[X - m(Y) \mid Y] = 0 by definition of mm. That leaves

MSE(g)=E[(X−m(Y))2]+E[(m(Y)−g(Y))2].\mathrm{MSE}(g) = \mathbb{E}\left[\left(X - m(Y)\right)^2\right] + \mathbb{E}\left[\left(m(Y) - g(Y)\right)^2\right].

The second term is never negative and is zero only when g=mg = m. So mm is the unique minimiser, and the smallest possible error is E[(X−m(Y))2]\mathbb{E}\left[\left(X - m(Y)\right)^2\right].

The error that remains

The minimum error is itself an average. Let Var(X∣Y)\mathrm{Var}(X \mid Y) be the variance of XX inside the conditional distribution, the spread of the values still possible after seeing YY. Then

MMSE=E[Var(X∣Y)].\mathrm{MMSE} = \mathbb{E}\left[\mathrm{Var}(X \mid Y)\right].

Seeing data cannot increase the expected error. It can only shrink the spread of what remains possible.

The linear case for Gaussians

For jointly Gaussian variables the conditional expectation has a simple form. If XX and YY have means zero, let Cov(X,Y)=E[XY]\mathrm{Cov}(X,Y) = \mathbb{E}[XY] be their covariance (the same idea as a covariance matrix entry) and Var(Y)\mathrm{Var}(Y) the variance of YY. Then

E[X∣Y]=Cov(X,Y)Var(Y) Y,Var(X∣Y)=Var(X)−Cov(X,Y)2Var(Y).\mathbb{E}[X \mid Y] = \frac{\mathrm{Cov}(X,Y)}{\mathrm{Var}(Y)}\, Y, \qquad \mathrm{Var}(X \mid Y) = \mathrm{Var}(X) - \frac{\mathrm{Cov}(X,Y)^2}{\mathrm{Var}(Y)}.

The best guess is a straight line in YY, and the constant Cov(X,Y)/Var(Y)\mathrm{Cov}(X,Y)/\mathrm{Var}(Y) is the gain: how much the reading should move the guess. Even when the variables are not Gaussian, the best linear rule g(Y)=aY+bg(Y) = aY + b (the linear MMSE estimator) has the same slope a=Cov(X,Y)/Var(Y)a = \mathrm{Cov}(X,Y)/\mathrm{Var}(Y), with the intercept b=E[X]−a E[Y]b = \mathbb{E}[X] - a\,\mathbb{E}[Y] set so the errors average to zero. It uses only means and covariances.

Worked examples

Example
Example 1: a coin between two values (tiny)

A hidden value XX is either 0 or 10, each with probability one half. A sensor reports the true value with probability 0.9 and the wrong value with probability 0.1. The sensor reports Y=10Y = 10.

  1. Before the reading, the best guess is the average, 12(0)+12(10)=5\frac{1}{2}(0) + \frac{1}{2}(10) = 5. Its mean squared error is Var(X)=25\mathrm{Var}(X) = 25, because the two values lie 5 away from 5.
  2. The joint probabilities are P(X=10,Y=10)=0.5×0.9=0.45P(X=10, Y=10) = 0.5 \times 0.9 = 0.45 and P(X=0,Y=10)=0.5×0.1=0.05P(X=0, Y=10) = 0.5 \times 0.1 = 0.05.
  3. Given Y=10Y = 10, the probability that X=10X = 10 is 0.45/(0.45+0.05)=0.90.45 / (0.45 + 0.05) = 0.9.
  4. The conditional expectation is E[X∣Y=10]=0.9×10+0.1×0=9\mathbb{E}[X \mid Y=10] = 0.9 \times 10 + 0.1 \times 0 = 9. So the MMSE guess after seeing 10 is 9, not 5 and not 10.
  5. The conditional error is 0.9×(10−9)2+0.1×(0−9)2=0.9+8.1=90.9 \times (10 - 9)^2 + 0.1 \times (0 - 9)^2 = 0.9 + 8.1 = 9.
  6. By symmetry the same holds for Y=0Y = 0, so the overall MMSE is 9.

Interpretation: the reading moves the guess from 5 to 9 and cuts the average squared error from 25 to 9. The reading is trusted, but not completely, so the guess stops short of 10.

Example
Example 2: a Gaussian hidden value and one noisy reading (standard)

Let X∼N(0,4)X \sim \mathcal{N}(0, 4) be the hidden value with variance 4, and let the noise N∼N(0,1)N \sim \mathcal{N}(0, 1) be independent of XX. The reading is Y=X+NY = X + N.

  1. Compute the needed covariances. Var(Y)=4+1=5\mathrm{Var}(Y) = 4 + 1 = 5 and Cov(X,Y)=Cov(X,X+N)=4\mathrm{Cov}(X, Y) = \mathrm{Cov}(X, X + N) = 4.
  2. The gain is Cov(X,Y)/Var(Y)=4/5=0.8\mathrm{Cov}(X,Y) / \mathrm{Var}(Y) = 4 / 5 = 0.8. So X^MMSE=0.8 Y\hat{X}_{\text{MMSE}} = 0.8\, Y.
  3. If the reading is Y=2.5Y = 2.5, the guess is 0.8×2.5=2.00.8 \times 2.5 = 2.0.
  4. If the reading is Y=−1Y = -1, the guess is 0.8×(−1)=−0.80.8 \times (-1) = -0.8. The guess is shrunk toward zero, as it should be, because zero is the prior centre.
  5. The MMSE is Var(X∣Y)=4−42/5=4−3.2=0.8\mathrm{Var}(X \mid Y) = 4 - 4^2 / 5 = 4 - 3.2 = 0.8. The standard deviation of the remaining error is 0.8≈0.89\sqrt{0.8} \approx 0.89, against a prior standard deviation of 2.

Interpretation: the noise variance 1 is small next to the signal variance 4, so the reading is trusted heavily (gain 0.8). The error variance drops from 4 to 0.8.

Example
Example 3: fusing two sensors with a prior (realistic)

A room's true temperature TT is believed to be Gaussian with mean 20 and variance 4 before any measurement, written T∼N(20,4)T \sim \mathcal{N}(20, 4). Two sensors read it. Sensor A has noise variance 1 and reads 22. Sensor B has noise variance 4 and reads 21. Assume the noises are independent of each other and of TT.

  1. Work in precisions, the reciprocal of variances, because precisions add. The prior has precision 1/4=0.251/4 = 0.25, sensor A has 1/1=11/1 = 1, and sensor B has 1/4=0.251/4 = 0.25. The total precision is 0.25+1+0.25=1.50.25 + 1 + 0.25 = 1.5.
  2. The posterior variance is the reciprocal of the total precision: 1/1.5≈0.6671 / 1.5 \approx 0.667. The remaining error has standard deviation 0.667≈0.82\sqrt{0.667} \approx 0.82.
  3. The posterior is the distribution of TT once all the readings are known, and its mean is a precision-weighted average of the prior mean and the readings: 20×0.25+22×1+21×0.251.5=5+22+5.251.5=32.251.5=21.5\dfrac{20 \times 0.25 + 22 \times 1 + 21 \times 0.25}{1.5} = \dfrac{5 + 22 + 5.25}{1.5} = \dfrac{32.25}{1.5} = 21.5.
  4. Because everything here is Gaussian, this posterior mean is exactly the MMSE estimate. It is linear in the readings, so the linear MMSE and the full MMSE coincide.

Interpretation: sensor A is four times as precise as sensor B, so it gets four times the weight. The weights are 1/1.5≈0.6671/1.5 \approx 0.667 for A and 0.25/1.5≈0.1670.25/1.5 \approx 0.167 each for B and the prior, so the estimate sits closest to A's reading of 22 and ends at 21.5. It is better than any single sensor (A alone would leave variance 1), and its error is about 0.82 degrees. Adding information always reduces the posterior variance, which is why sensor fusion works. The Bayesian reading of the same calculation is in Bayes' rule with the prior distribution on TT.

Tradeoffs and failure modes

The squared-error criterion is a choice, and the conditional expectation is only optimal for that choice. The table below lists when MMSE is the right tool and what breaks it.

SituationWhat goes wrongBetter choice
Joint distribution of XX and YY is known and GaussianNothing; the MMSE is linear and cheapUse the Gaussian formula
Distribution is unknown or non-GaussianComputing E[X∣Y]\mathbb{E}[X \mid Y] needs the full posterior, which is often intractableLinear MMSE: only means and covariances are needed
Error cost is absolute rather than squaredThe mean overreacts to outliersUse the median of the posterior
You need the single most probable valueThe mean can sit in a region of low probability for skewed or multimodal posteriorsUse the mode, as in [[maximum-a-posteriori-estimation
The model's covariances are wrongThe gain is wrong, so the guess is biased and the error bars lieEstimate the noise model first, or use a robust method
Many variables, large dimensionMatrix inversions grow quicklyRecursive filters such as the [[kalman-filter

A common failure is trusting the posterior variance too much. The formula gives the smallest error if the noise model is right. If the true noise is heavier-tailed than assumed, the real error is larger than the reported one. The bias-variance view of this trade is in Bias-Variance Tradeoff.

History

The idea grew out of wartime prediction problems. In the early 1940s, Norbert Wiener at MIT worked on predicting the path of aircraft for anti-aircraft fire control, and he treated the noisy signal as a stationary random process. His method, the Wiener filter, chooses the linear filter that minimises mean squared error. Wiener's results were published as a classified report in 1942 and reached a wider audience in his 1949 book on time-series extrapolation, interpolation and smoothing. In the Soviet Union, Andrey Kolmogorov reached closely related results for discrete time around the same period.

In the 1950s and 1960s, the same mathematics was rewritten for data that arrive one step at a time. Rudolf Kálmán's 1960 paper gave the recursive form, now the Kalman filter, which applies the MMSE update at every time step. It became central to navigation, including the Apollo missions, and to control engineering. Estimation theory textbooks, such as Steven Kay's Fundamentals of Statistical Signal Processing, now treat MMSE as the baseline against which other estimators are compared.

Recap

  • The hidden value is unknown, and the reading carries noisy information about it.
  • The MMSE guess is the conditional expectation E[X∣Y]\mathbb{E}[X \mid Y], the average of what is still possible after the reading.
  • For Gaussians it is a straight line in the reading, with a gain set by the ratio of signal variance to total variance.
  • The error that remains is the average of the conditional variance. Data never increases it.
  • The same idea, applied one step at a time, gives the Kalman filter and sits on top of Gaussian and multivariate Gaussian models.

Check yourself

QuestionWhat is the single best guess of X given an observation Y, in the sense of minimising the mean squared error?Show answer

The conditional expectation E[X∣Y]\mathbb{E}[X \mid Y]. It is the average of X over all values that are consistent with the observed Y, weighted by their conditional probabilities. Any other rule g(Y) adds the non-negative term E[(m(Y)−g(Y))2]\mathbb{E}[(m(Y) - g(Y))^2] to the error, so it cannot beat this one.

QuestionIn the Gaussian setup with X having variance 4, noise variance 1, and reading Y = 2.5, what is the MMSE guess? What is the remaining error variance?Show answer

The gain is Cov(X,Y)/Var(Y)=4/5=0.8\mathrm{Cov}(X,Y)/\mathrm{Var}(Y) = 4/5 = 0.8, so the guess is 0.8×2.5=2.00.8 \times 2.5 = 2.0. The remaining error variance is 4−42/5=0.84 - 4^2/5 = 0.8. The reading still counts for a lot, since the signal dominates the noise, but the guess is shrunk from 2.5 toward zero.

QuestionWhy does the MMSE estimate of a Gaussian hidden value come out linear in the reading, even though a general conditional expectation can be a complicated function?Show answer

For jointly Gaussian variables, the conditional distribution of X given Y is Gaussian, and its mean depends on the observed Y only through a straight-line formula. The shape of the distribution is preserved under conditioning, and only its centre moves. So the conditional expectation is linear in Y. Sums and scalings of Gaussians stay Gaussian, which is what makes the calculation closed.

QuestionA sensor with noise variance 1 is replaced by one with noise variance 100, and the other readings stay the same. How should the estimate change, qualitatively?Show answer

The second sensor now carries much less precision, so its weight in the precision-weighted average falls close to zero. The estimate moves toward the prior mean, and the posterior variance grows, because the total precision has dropped. A very noisy reading should barely move the guess, and the formula reflects this automatically.

Sources