How do I use categorical predictors in a regression model?
Answer
Categorical predictors are represented with dummy (indicator) variables in a regression model.
Think of a dummy variable as an on/off switch that has a value of 1 when the switch is turned on, and 0 when the switch is turned off. For example, if you want to include gender in a regression model, you could say that the variable has a value of 1 when the subject is female, and a value of 0 when the subject is male. The accompanying coefficient represents the change in the mean response from men to women. Note that the value of the dummy variable changes the location of the intercept but does not change the effect of other variables.
It is also possible to fit models with categorical predictors that have more than two groups.