How to use the law of total variance

1.1k Views Asked by At

I know that the law of total variance states $$Var(X)=\Bbb E[Var(X|Y)]+Var(\Bbb E[X|Y])$$ But how does one treat $Var(X|Y)$ and $\Bbb E[X|Y]$ as random variables? For example, say we know that $$\Bbb E[X|Y=y]=y \ \ \ \text {and} \ \ \ Var(X|Y=y)=1$$ I take it that directly calculating the expected value of $x$ and the variance of $1$ is not possible. So how does one actually do this practically?

2

There are 2 best solutions below

0
On

The idea is that the expectation will be some function of $y$ i.e. $\mathbb{E}[X|Y=y] = f(y)$. In these cases, expectation and variance decomposition lemmas are useful.

Take ANOVA for e.g.

$Var(X)=\Bbb E[Var(X|Y)]+Var(\Bbb E[X|Y])$ is nothing but cross-group variance - $\Bbb E[Var(X|Y)]$ + within-group variance - $Var(\Bbb E[X|Y])$.

2
On

Don't confuse $\Bbb E[X|Y]$ and $\Bbb E[X|Y=y]$

$\Bbb E[X|Y]$ is a random variable, function of the random variable $Y$, $$\Bbb E[X|Y]=g(Y)$$ $\Bbb E[X|Y=y]$ is a number, $$\Bbb E[X|Y=y]=g(y)$$ You can compute both if you know the joint distribution of $X$ and $Y$, same with variance $\Bbb Var[X|Y]$ (random variable) or $\Bbb Var[X|Y=y]$ (number).