# How to check if two categorical variables are related (in a two-way table)? Confused

#### mathsucks

##### New Member
Hi,

My question might seem pretty dumb but I'm teaching statistics to myself and never had in school or uni. I use a book and I'm currently trying to learn the chapter about two-way tables with two categorical variables.

In the book, it is written that you can check if two categorical variables are dependent or independent by comparing their conditional probabilities (which you can find when looking at the two-way table). However, on the next sites it is written that you compare the conditional probability to the marginal probability to see whether two categorical variables are independent or not.

Now, what is true? Or are both methods right?

Thank you

#### hlsmith

##### Not a robit
Re: How to check if two categorical variables are related (in a two-way table)? Conf

Both ways kind of make sense. What book and what page? Do they give an example with data?

The first can be done looking at odds ratios or (p1/(1-p1)) /( p2/(1-p2)), with p's coming from first row and 2nd row or depending on table - first column and second column.

I can't think of the second scenario calculation, but if you think about the wording, it is saying compare probability to when you condition and don't condition. Reminds me of the Cochran-Mantel-Haenzel (sp?).

#### gianmarco

##### TS Contributor
Re: How to check if two categorical variables are related (in a two-way table)? Conf

Hello!
As for me, I usually approach the problem from a "independence" standpoint. This entails using chi-square test (i.e., assessing how much the observed counts depart from the expected ones, and getting a p value), coupled by a categorical association measure (Pearson phi, or Cramer V, etc) and, if you reject the Null Hypothesis, by the inspection of standardized residuals.

cheers
gm