Contrast coding for categorical predictors
A linear regression model is a mathematical object. Consequently, if we want to model the association between a categorical predictor and some outcome variable, we need to represent the levels of our categorical predictor as numbers.
The umbrella term for all the different ways that we could possibly represent categorical predictors as numbers is “contrast coding”.
In DAPR2 we will cover two common contrast coding schemes:
- Treatment coding, where levels of categorical predictors are represented using 0s and 1s.
- Sum coding (only really useful for binary predictors), where levels of binary predictors are represented using –1s and 1s.
You should choose your contrast coding scheme based on the hypotheses you want to test. See each flash card for more details.