Categorical data records membership in distinct groups rather than measured numerical amounts. Analysts must represent those groups appropriately before including them in models or comparisons. section 9.2.1
Common analytical treatments include:
- Use dummy coding to represent each category as a separate binary variable indicating presence or absence. section 9.2.1
- Omit one category when appropriate; its absence is then represented when all remaining category variables equal zero. section 9.2.1
- Collapse categories into a meaningful binary variable when the grouped distinction better represents the analytical question. section 9.2.1
- Use the chi-square test to compare one or two categorical variables through observed and expected frequencies in a contingency table. section 5.4
Choice of representation should connect to the decision being supported. A day-of-week variable can preserve behavioral information, support predictions for future days, and avoid unnecessary complexity when categories have similar outcomes. Analysts should weigh the effort and advantages of deriving additional variables rather than applying a fixed rule. section 9.2.1
Rat sightings by day of week
A daily New York City rat-sightings dataset derives a day-of-week column, examines distributions with boxplots, and dummy-codes the seven days. Because weekday categories show little difference, the analysis creates a single weekday indicator and checks its correlations with temperature, wind speed, and sightings. section 9.2.1















