7.4 Working with Categorical Outcomes

The analyses I’ve presented so far are geared towards cases where the outcome variable is numeric. Dealing with a categorical outcome variable introduces additional complexity. In such situations, when both the outcome and predictor variables are categorical, we typically employ a χ² test. On the other hand, when the predictor is numeric and the outcome is categorical, we might opt for a logistic or multinomial logistic regression.

It’s important to note that these analyses don’t conform to the general linear model framework. Instead, they fall under a different category of models known as generalised linear models.

The exciting part is, that regardless of the statistical method you’re using – whether it’s a t-test, ANOVA, regression, or other advanced techniques like mixed models, random forests, or generalised linear models – the process for fitting and visualising the model, as well as computing model estimates, remains consistent when you utilise flexplot:

  1. Fit the model model = lm(y~x, data=data)
  2. Visualise the model visualise(model)
  3. Compute estimates for the model estimates(model)

This uniformity was intentional and designed for simplicity. Even as we delve into more complex statistical topics after the probability chapter, the process continues to follow the same steps:

  1. Fit the model
  2. Visualise the model with the visualise command.
  3. Compute the estimates with the estimates command.

Beyond the probability chapter, we’ll introduce a few additional steps, including fitting an alternative model, visualising both models and performing model comparisons. However, the core process remains consistent, regardless of the nature of the independent and dependent variables, whether they are numeric, categorical, or involve various groupings.

This streamlined approach greatly simplifies the analytical process.

 

Chapter attribution

This chapter contains material taken and adapted from The Order of the Statistical Jedi by Dustin Fife, used under a CC BY-SA 4.0 licence.

License

Icon for the Creative Commons Attribution-ShareAlike 4.0 International License

7.4 Working with Categorical Outcomes Copyright © 2023 by Klaire Somoray is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where otherwise noted.