However, the ANOVA method works whether or not we used orthogonal
polynomials; it also works when we have other terms in the model as well.
For example, we can use anova() to compare these three models:
fit.1 <- lm(wage ~ education + age, data = Wage)
fit.2 <- lm(wage ~ education + poly(age, 2), data = Wage)
fit.3 <- lm(wage ~ education + poly(age, 3), data = Wage)
anova(fit.1, fit.2, fit.3)
medv as dependent variable and crim as independent variable.
Use the orthogonal polynomials.
Also add rm and lstat as additional predictors (only linear functions).
The model of degree-1 for crim should be stored in the variable fit.1, model of degree-2 in fit.2, etc.anova.medv.crim + rm + lstatcrim + rm + lstatcrim + rm + lstatAssume that: