22.3. Variance by Conditioning#
See More
Iteration allows us to find expectation by conditioning. We now have the tools to find variance by conditioning as well.
Recall the notation of the previous section:
\(X\) and \(Y\) are jointly distributed random variables
\(b(X) = E(Y \mid X)\)
\(D_w = Y - b(X)\)
Define \(D_Y = Y - E(Y)\). Then
where \(D_b = b(X) - E(Y)\) is the deviation of the random variable \(b(X)\) from its expectation \(E(Y)\).
In the graph below, the black line is at the level \(E(Y)\), and the dark blue point is a generic point \((X, Y)\) in the scatter plot. Its distance from the black line is \(D_Y\) and is equal to the sum of two lengths:
\(D_w\), the length of the purple segment
\(D_b\), the length of the green segment
See More
22.3.1. Decomposition of Variance#
The expectation \(E(Y)\) is a constant. That means \(D_b = b(X) - E(Y)\) is a function of \(X\), and hence \(E(D_wD_b) = 0\). So
Let’s take a closer look at the two terms on the right hand side. In the previous section we saw that
Thus the first term on the right hand side is the expectation of the conditional variance.
To understand the second term, note that \(D_b = b(X) - E(Y) = b(X) - E(b(X))\). So
Thus the second term on the right is the variance of the conditional expectation.
We thus have a decomposition of variance:
That is, the variance is equal to the expectation of the conditional variance plus the variance of the conditional expectation.
It makes sense that the two quantities on the right hand side are involved in the calculation of \(Var(Y)\). The variability of \(Y\) has two components:
the rough size of the variability within the individual vertical strips, that is, the expectation of the conditional variance
the variability between strips, measured by the variance of the centers of the strips.
The variance decomposition show that you can just add the two terms to get \(Var(Y)\).
This decomposition is the basis of analysis of variance (ANOVA), widely used in statistics. In this course we are going to use it to find variances by conditioning.