As a demonstration of how models partition variatoin, I am going to construct a model and compare the variation in the response variable to the variations in the fitted values and residuals.
swim = fetchData("swim100m.csv")
## Retrieving from http://www.mosaic-web.org/go/datasets/swim100m.csv
mod = lm(time ~ year + sex, data = swim)
First, note that the variance of the response variable is:
var(time, data = swim)
## [1] 98.34
Then, notice that the variance of the fitted model and the variance of the residual model are:
var(fitted(mod))
## [1] 83
var(resid(mod))
## [1] 15.34
We can now conclude that the sum of the variance of the fitted model and the residual model is the variance of the response variable.
We will observe now that this does not apply to the standard deviation of the model. First we note the standard deviation of the response variable.
sd(time, data = swim)
## [1] 9.917
Now we look at the standard deviation of the fitted model and the residual model.
sd(fitted(mod))
## [1] 9.11
sd(resid(mod))
## [1] 3.917
We can see that the sum of the standard deviation of the fitted model and the residual model does not equal to the standard deviation of the repsonse variable.