3.8 Qualitative Predictors

  • Dummy variables: if there are \(k\) levels, introduce \(k-1\) dummy variables which are equal to one (“one hot”) when the underlying qualitative predictor takes that value. For example if there are 3 levels, introduce two new dummy variables and fit the model:

\[y_i = \beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} + \epsilon_i\]

Qualitative Predicitor \(x_{i1}\) \(x_{i2}\)
level 0 (baseline) 0 0
level 1 1 0
level 2 0 1
  • Coefficients are interpreted the average effect relative to the baseline.

  • Alternative is to use index variables, a different coefficient for each level:

\[y_i = \beta_{0 1} + \beta_{0 2} +\beta_{0 3} + \epsilon_i\]