# Graphical proof of variance decomposition for linear regression

Suppose we aim to predict $$Y$$ from $$X$$ using the linear regression model $$Y = mX + b$$. There is a standard variance decomposition:

$$\operatorname{Var}[Y] = \operatorname{Var}[\widehat{Y}] + \operatorname{Var}[R],$$

where $$\widehat{Y}=mX+b$$ is the model's prediction at $$X$$ and $$R=Y-\widehat{Y}$$ is the residual. Thus, the variance of the $$Y$$'s is equal to the sum of the variance of the predictions and the variance of the residuals.

I can derive this algebraically. But is there a simple graphical proof? Or some other way to see why this is true, in a way that doesn't require much in the way of formulas or algebraic derivations?

• In subject space, Prediction and residuals are perpendicular vectors stats.stackexchange.com/a/124892/3277 with variances being their squared lengths. Therefore, according to pythagorean theorem..... – ttnphns Nov 13 '18 at 8:59
• @ttnphns, interesting! How can we see that they are perpendicular? In other words, why are they guaranteed to be perpendicular? – D.W. Nov 13 '18 at 22:48

$$Var[Y] = Var[red] + Var[blue]$$

Code:

x <- rnorm(10)
y <- rnorm(10, x)
plot(x, y, pch=19, col="blue", bty="n")
m <- lm(y ~ x)
abline(m, col="red")
ypred <- predict(m, newdata=data.frame(x=x))
segments(x, ypred, x, y, col="blue")

• Yes, that is a good picture illustrating what that equation is saying. But I'm asking for something to help explain why the equation is true. Why should it be true that Var[y] = Var[red] + Var[blue]? I'm not seeing how to get that from the picture. Did you have some thoughts on that? Apologies if my question was confusing/unclear. – D.W. Nov 13 '18 at 22:44
• Well, I'd say that the figure shows that there is some "red" variance which is what our model explains, but to get to the real y values we need to add the "blue" variance. Maybe a better question would be: how to show graphically why (given certain assumptions) is the sum of variances equal to the variance of the sum? – January Nov 14 '18 at 7:51
• Yes, that is exactly what I am asking. – D.W. Nov 14 '18 at 16:10
• OK, so maybe you should ask another question, without referring to linear regression. – January Nov 14 '18 at 17:58
• This question is specific to linear regression, so it can't be asked without that context. It is not true in general that $\text{Var}[U+V]=\text{Var}[U]+\text{Var}[V]$; it happens to be true in this case, for the specific random variables mentioned in the question, due to some specifics about how those random variables are related, but the question is why -- the question can't be separated from the context. – D.W. Nov 14 '18 at 18:23