# How to do mediation analysis when dependent variable is categorical

Hello I'm currently doing my undergrad thesis and I'm stuck as to what Approach of mediation analysis should I use:

X ( independent var.) Is continuous M ( mediator ) is Continuous Y ( dependent var.) Is categorical

I have searched and Stumbled upon different answers if X is categorical but I haven't seen an answer that explains how to analyze it when Y is categorical.

• How many categories in Y? If more than 2, is there a natural ordering of the categories?
– EdM
Jul 19, 2022 at 3:24
• Thank you for responding.There are 5 categories in Y and there's no natural ordering of categories. Jul 19, 2022 at 6:46

## 1 Answer

Your regression method for evaluating outcome is presumably multinomial logistic regression. Thus you have multiple regression coefficients associated with your predictor variables, each representing a predictor's association with the log-odds of a particular outcome category versus a reference category. It should still be possible to evaluate mediation in that case, but with multiple coefficients this requires a bit more thought and care than with single continuous outcomes modeled with ordinary least squares (OLS).

This answer includes a reference to paper that suggests one way to proceed. You can combine coefficient estimates as needed for mediation analysis by taking advantage of their limiting normal distributions (regardless of whether you are using OLS or generalized models) and standardizing them (and their combinations) against their standard errors.

The R mediation package provides tools that might be more aligned with modern causal analysis. Although it allows for binary regressions as modeled with the R glm() function, I'm not sure whether it allows for multinomial regression models. A workaround, if it doesn't, might be to adopt a method used back when some software packages could fit binomial but not multinomial outcomes: choose the most frequent outcome category as the reference level, and do a series of binomial regressions of each other level against it. That isn't as efficient as a single multinomial model and can lead to sums of estimated probabilities among all outcome categories different from 1, but it can work reasonably well. The second edition of Agresti's Categorical Data Analysis illustrates that approach in Section 7.1.4.

I'd recommend discussing the best approach with your advisor, with these issues in mind.