# Regression with only categorical variables

Is it possible to conduct a regression if all dependent and independent variables are categorical variables?

• It's certainly possible, even for common or garden regression, so long as the response (dependent) variable is be treated purely numerically. Depending on your software, you may need to push or force that to happen. With a suitably wide definition of regression, to include logistic or ordinal regression, it's not only possible, it's commonplace. – Nick Cox Jul 28 '13 at 14:17

## 1 Answer

We need to be clear on our terms here, but in general, yes:

• If your dependent variable is continuous (and the residuals are normally distributed—see here), but all of your independent variables are categorical, this is just an ANOVA.
• If your dependent variable is categorical and your independent variables are continuous, this would be logistic regression (possibly binary, ordinal, or multinomial, depending).
• If both your dependent variable and your independent variables are categorical variables, you can still use logistic regression—it's kind of the ANOVA-ish version of LR.

Note that both logistic regression and ordinary least squares (linear) regression are special cases of the Generalized Linear Model.

• It is the third case that you have mentioned, i tried LR, none of the coefficients found to be significant. I thought i might be doing something wrong. – altruist Jul 28 '13 at 14:20
• I don't think ANOVA requires a continuous dependent variable any more than it requires normally distributed residuals. These are just conditions under which ANOVA is expected to work well. – Nick Cox Jul 28 '13 at 14:20
• @NickCox, you're right, of course; we're quibbling over how we define & apply these terms. The way I would put it is that the model is derived from those assumptions, but the ANOVA can be used even if they aren't met, w/ the question of whether the results will be helpful depending. – gung - Reinstate Monica Jul 28 '13 at 14:25
• @altruist, I laid out the three cases for the sake of conceptual clarity; I recognize that the last is what you want. Note that whether or not you're using the software correctly to fit the model & whether or not your coefficients are 'significant' is unrelated to whether or not LR is the appropriate model for your situation. – gung - Reinstate Monica Jul 28 '13 at 14:27
• Note that being categorical is sometimes a matter of definition for the software, and sometimes in the mind of the beholder. What is number of children, for example? – Nick Cox Jul 28 '13 at 14:31