10.4 Comparing the Interaction Model to the Additive Model with Two Quantitative Predictors
The most direct way to compare the interaction model to the additive model is to produce the ANOVA table for the interaction model, and then zero in on one row.
Use the code window below to generate the ANOVA table for the interaction model.
require(coursekata)
# generate the ANOVA table for the interaction model
# (no models have been pre-saved for you)
# generate the ANOVA table for the interaction model
# (no models have been pre-saved for you)
supernova(lm(PriceK ~ YearBuilt * HomeSizeK, data = Ames))
# or alternatively: supernova(lm(PriceK ~ HomeSizeK * YearBuilt, data = Ames))
ex() %>% check_or(
check_function(., "supernova") %>%
check_result() %>%
check_equal(),
override_solution(., "supernova(lm(PriceK ~ HomeSizeK * YearBuilt, data = Ames))") %>%
check_function("supernova") %>%
check_result() %>%
check_equal()
)CK Code: D4_Code_Comparing_01
We added in an argument to the supernova() function to make the ANOVA table a little less cluttered with detail.
supernova(lm(PriceK ~ YearBuilt * HomeSizeK, data = Ames), verbose = FALSE)
Analysis of Variance Table (Type III SS)
Model: PriceK ~ YearBuilt * HomeSizeK
SS df MS F PRE p
------------------- | ---------- --- ---------- ------- ------ -----
Model | 528182.561 3 176060.854 301.958 0.8335 .0000
YearBuilt | 179.332 1 179.332 0.308 0.0017 .5799
HomeSizeK | 7731.615 1 7731.615 13.260 0.0683 .0004
YearBuilt:HomeSizeK | 9392.093 1 9392.093 16.108 0.0817 .0001
Error | 105534.655 181 583.064
------------------- | ---------- --- ---------- ------- ------ -----
Total | 633717.215 184 3444.115