# Association between more than 2 categorical variables

Is there a method that can detect an association between several categorical variables? I know that chi2 test Can help me with paired variables, but imagine the usecase with 5 variables and there IS an hiden association between V1,V2 and V3: i can't see the association between triplet variables (or more).

You can do chi square with more the two variables. Or, indeed, with only one variable. There may be problems with sparse cells, but that would affect other methods too. You could also look into log linear models.

• Ah it is interesting! I just know indépendance chi2 test and adéquation chi2test for 2 variables, and didn't know it would be possible for multiple variables (more than 3). If you have any good référence it would be great! Commented Jul 3 at 16:55
• I suppose that if you have A,B,C 3 variables you can imagine making a contingence table comparing A with BC where BC give all cross catégories (and i am wondering if AxBC give same résults than ABxC). But thanks a lot for the direction ! Commented Jul 3 at 17:08
• You can do it for any number of variables. It's still just a measure of observed minus expected (same formula as for two way). But, like regular chi square, it doesn't test more specific hypotheses. Commented Jul 3 at 17:59

Feels like you are doing this the wrong way round. I would try to suggest/model how the data was generated, this would give a testable hypothesis, this would then suggest a metric for correlation.

For example, I don't know much about epidemiology of smoking, so if I was asked to look for interaction between smoking and gender I would suggest that perhaps there is some common propensity of people to smoke and then there may be gender specific adjustments relative to that. So the model for generating data would be something like, probability to smoke:

\begin{align} S_{m,f} &\sim Bernoulli(\pi_{m,f}) \\ \pi_{m}&=expit\left(\eta+\xi_m\right)\\ \pi_{f}&=expit\left(\eta+\xi_f\right) \end{align}

$$\eta$$ (common predisposition to smoke), $$\xi_m$$ (male-specific adjustment), $$\xi_f$$ (female-specific adjustment). The magnitude of $$\xi$$ relative to $$\eta$$ would then be my measure of interaction.