MMSE estimation: Unable to verify property of MMSE

75 Views Asked by At

$\newcommand{\Var}{\operatorname{Var}}$I am trying to verify,using code, property of MMSE estimator.

If $X_M=E[X\mid Y]$ is unbiased estimator of $X$, property I want to verify is $$\Var(X) = \Var(X_M) + \Var(\tilde{X})$$

where $\tilde{X}$ is the error in estimation.

I am quoting from THIS online resource.

Please tell me where I am wrong.

I am writing code in octave. For matlab, equivalent function to randsample is datasample.

Say X, Y have joint distribution. I computed PDF for X and PDF for E(X|Y)

Joint PDF of X and Y

X|Y  -1    0   1
2    1/6  2/6  0
3    2/6   0   0
4     0    0  1/6

PDF of X

    1/2   2/6   1/6
  X  2     3     4

PDF of Z=E(X|Y)

         2/6   1/2   1/6
Z=E[X/Y]  2    8/3    4

CODE

nSamples = 100000;

RX = [2 3 4];
PrX = [1/2 2/6 1/6];
X = randsample(RX,nSamples,true,PrX);

RZ = [2 8/3 4];
PrZ = [2/6 1/2 1/6];
Z = randsample(RZ,nSamples,true,PrZ);

Xtilde = X - Z;
disp(var(X))
disp(var(Z))
disp(var(Xtilde))