Page 174 - Applied Statistics with R
P. 174
174 CHAPTER 9. MULTIPLE LINEAR REGRESSION
# SSE
sum(resid(full_mpg_model) ^ 2)
## [1] 4556.646
# SST
sum(resid(null_mpg_model) ^ 2)
## [1] 23761.67
# Degrees of Freedom: Regression
length(coef(full_mpg_model)) - length(coef(null_mpg_model))
## [1] 2
# Degrees of Freedom: Error
length(resid(full_mpg_model)) - length(coef(full_mpg_model))
## [1] 387
# Degrees of Freedom: Total
length(resid(null_mpg_model)) - length(coef(null_mpg_model))
## [1] 389
9.4 Nested Models
The significance of regression test is actually a special case of testing what we
will call nested models. More generally we can compare two models, where
one model is “nested” inside the other, meaning one model contains a subset of
the predictors from only the larger model.
Consider the following full model,
= + + + ⋯ + ( −1) ( −1) +
0
1 1
2 2
This model has − 1 predictors, for a total of -parameters. We will denote
the fitted values of this model as ̂ .
1
Let the null model be

