How can we do computations on categorical data? How do we plug a categorical variable like gender (male/female) into a mathematical equation? Categorical variables must be converted into one or more indicator variables. An indicator variable is a variable that can take on two values: a zero or a one. A zero indicates the absence of the attribute and a one indicates the presence of the attribute. The number of indicator variables needed for a categorical variable with H levels is H - 1.
|
Examples |
| xgender | = 0 if female, and | ||
| xgender | = 1 if male. | ||
| x1 | = 1 if M.A, and | ||
| x1 | = 0 otherwise | ||
| x2 | = 1 if Ph.D, and | ||
| x2 | = 0 otherwise | ||
The figures ?? and ?? illustrate the importance of utilizing indicator variables when analyzing categorical variables, as opposed to treating categorical variables as continuous variables.
|
|
|