# Statistical test for association between 3 categorical variables

If I want to find the association between three categorical variables (all coded yes/no). What statistical test should I use?

I have read online that I can use multiple linear regression. But I have always thought that there needs to be at least one continuous variable. Is that right? My understanding is that chi-squared can be used to compare two variables each time. Is that right?

• If none are continuous you cannot use multiple regression. What is it you want to find out about these variables? Do you just want to see if there is some form of bivariate non-independence for each of the 3 pairings? Do you want to see if you can predict one of them (which?) from the other two? Etc. May 20, 2015 at 0:29
• i am trying to see if there are any associations between the 3 variables.. so one of them is a dependent variable and the other two would be independent.. not sure if i have answered you question.. May 20, 2015 at 0:54
• chronbach's alpha might work for what you want. If not, look at other related measures. May 20, 2015 at 3:54
• The Cochran–Mantel–Haenszel test might work for you. You can also look around for 3 way contingency tables. May 21, 2015 at 0:42

## 3 Answers

You can run loglinear analysis. Check out Andy Field's Disovering Statistics Using R. He has an entire section on this in Chapter 18. A chi square test of independence is an extension/derived from loglinear analysis such that a chi square test tests for a two way interaction between your two categorical variables. If a chi square test is significant, that implies a significant two way interaction between your categorical variables and therefore, are not independent (that's how the chi square test of "independence" gets its name). You can extend loglinear analysis to include three variables so that you can test for a relationship between three categorical variables. You basically start off with a saturated model that includes all of your 3 main effects, 3 two way interactions, and a single 3 way interaction. You then remove the three way interaction from the model and then compare the saturated model to the new model using a likelihood ratio test (basically comparing the deviance of the new model to the deviance of the previous model). If the likelihood ratio test is a significant, then you can say that there is a significant three way interaction between your categorical variables. You can then stratify your data using the levels of one of your categorical variables (which categorical variable you choose depends on what you find is interesting) and follow up with two separate chi square test of independence.

(I just realized this question is from a few year past. Anyways, I hope this offers clarification nevertheless).

To visualize the association you can use Mosiac plot or may be heat chart. For statistical testing, you can apply loglinear models.
If you are using R, the following link may be helpful:

http://cran.r-project.org/web/packages/vcdExtra/vignettes/vcd-tutorial.pdf

You can do two pairwise chi-squared tests (outcome vs exposure 1, outcome vs exposure 2), or you can fit a logistic regression in the form of: $$logit(outcome)=exposure_1 + exposure_2$$

This can be easily implemented in a statistical software like R. Here is something that might help you with fitting a logistic regression in R: https://cran.r-project.org/web/packages/HSAUR/vignettes/Ch_logistic_regression_glm.pdf.