Page 195 - Applied Statistics with R
P. 195
Chapter 11
Categorical Predictors and
Interactions
“The greatest value of a picture is when it forces us to notice what
we never expected to see.”
— John Tukey
After reading this chapter you will be able to:
• Include and interpret categorical variables in a linear regression model by
way of dummy variables.
• Understand the implications of using a model with a categorical variable
in two ways: levels serving as unique predictors versus levels serving as a
comparison to a baseline.
• Construct and interpret linear regression models with interaction terms.
• Identify categorical variables in a data set and convert them into factor
variables, if necessary, using R.
So far in each of our analyses, we have only used numeric variables as predictors.
We have also only used additive models, meaning the effect any predictor had
on the response was not dependent on the other predictors. In this chapter,
we will remove both of these restrictions. We will fit models with categorical
predictors, and use models that allow predictors to interact. The mathematics
of multiple regression will remain largely unchanging, however, we will pay close
attention to interpretation, as well as some difference in R usage.
195

