Page 175 - Applied Statistics with R
P. 175
9.4. NESTED MODELS 175
= + + + ⋯ + ( −1) ( −1) +
1 1
2 2
0
where < . This model has −1 predictors, for a total of -parameters. We
will denote the fitted values of this model as ̂ .
0
The difference between these two models can be codified by the null hypothesis
of a test.
∶ = +1 = ⋯ = −1 = 0.
0
Specifically, the -parameters from the full model that are not in the null model
are zero. The resulting model, which is nested, is the null model.
We can then perform this test using an -test, which is the result of the following
ANOVA table.
Degrees of Mean
Source Sum of Squares Freedom Square
2
Diff ∑ ( ̂ − ̂ ) − SSD/( − ) MSD/MSE
=1 1 0
Full ∑ ( − ̂ ) 2 − SSE/( − )
=1 1
Null ∑ ( − ̂ ) 2 −
=1 0
2
∑ ( ̂ − ̂ ) /( − )
= =1 1 0 .
2
∑ ( − ̂ ) /( − )
=1 1
Notice that the row for “Diff” compares the sum of the squared differences of
the fitted values. The degrees of freedom is then the difference of the number
of -parameters estimated between the two models.
For example, the autompg dataset has a number of additional variables that we
have yet to use.
names(autompg)
## [1] "mpg" "cyl" "disp" "hp" "wt" "acc" "year"
We’ll continue to use mpg as the response, but now we will consider two different
models.
• Full: mpg ~ wt + year + cyl + disp + hp + acc
• Null: mpg ~ wt + year

