# Lesson 8: Categorical Predictors

### Introduction

In Lesson 6, we utilized a multiple regression model that contained binary or *indicator* variables to code the information about the treatment group to which rabbits had been assigned. In this lesson, we investigate the use of such indicator variables for coding qualitative or *categorical* predictors in multiple linear regression more extensively. Although we primarily focus on categorical predictors with just two categories or *levels*, the methods and concepts extend readily to general categorical variables that, rather than defining just two groups, define *c* groups.

What happens if the effect of a categorical predictor on the response *y* depends on another (quantitative) predictor? In that case, we say that the predictors "interact." In this lesson, we learn how to formulate multiple regression models that contain "interaction effects" as a way to account for predictors that do interact.

We also investigate a special kind of model—called a "piecewise linear regression model"—that uses an interaction term as a way of creating a model that contains two or more different linear pieces.

### Learning objectives and outcomes

Upon completion of this lesson, you should be able to do the following:

- Formulate a multiple regression model that contains one qualitative (categorical) predictor and one quantitative predictor.
- Determine the different mean response functions for different levels of a qualitative (categorical) predictor variable.
- Answer certain research questions based on a regression model with one qualitative (categorical) predictor and one quantitative predictor.
- Understand and appreciate the two advantages of fitting one regression function rather than separate regression functions — one for each level of the qualitative (categorical) predictor
- Properly code a qualitative variable so that it can be incorporated into a multiple regression model.
- Be able to figure out the impact of using different coding schemes.
- Interpret the regression coefficients of a linear regression model containing a qualitative (categorical) predictor variable.
- Understand the distinction between additive effects and interaction effects.
- Understand the impact of including an interaction term in a regression model.
- Know how to use a formulated model to determine how to test whether there is an interaction between a qualitative (categorical) predictor and a quantitative predictor.
- Know how to answer various research questions for models with interaction terms.
- Know the impact of leaving a necessary interaction term out of the model.
- Know how to formulate a piecewise linear regression model for two or more connected linear pieces.