# Chi square test of independence - test of difference or association?

#### rogojel

##### TS Contributor
hi,
you could also use the "predict" function to get the probabilities of getting a heart attack in both cases. This is probably easier to communicate than odds ratios.

regards

#### Venus7

##### New Member
I think I found some clarity from yet another stats textbook I got my hands on. From the text:

• "In fact, the chi-squared test of independence is equivalent to a test for equality of two population proportions. Section 7.2 presented a z test statistic for this, based on dividing the difference of sample proportions by its standard error ... The chi-squared statistic relates to this z statistic by X^2 = z^2."

"For a 2x2 table, why should we ever do a z test if we can get the same result with chi-squared? An advantage of the z test is that it also applies with one-sided alternative hypotheses ... The direction of the effect is lost in squaring z and using X^2."

This last point is the one I was trying to ask about earlier when I mentioned that in doing a two-sample hypothesis test, we can actually specify a direction within the test itself. We can't do that with chi square. Thus, for example, if I wanted to know if women are MORE LIKELY to vote democrat than men (a one-tail or one-sided test), a two-sample z test helps me do this.

The textbook goes on to say that we need chi-squared for larger tables than 2x2, as we then have more than one comparison: "we could use a z statistic for each comparison, but not a single z statistic for the overall test of independence".

Hi Frodo. Thanks for sharing. What's the name of the textbook you used?

#### noetsi

##### Fortran must die
Venus I think you are addressing a question that was last addressed here in 2016. I am not sure the person you are asking a question of even comes here any more.

There are chi square test of independence and chi square test of goodness of fit and to me they measure very different concepts although I am not sure [thus my question today which I am having trouble finding].

Does anyone know if the use of a chi square test of deviance in a multilevel logistic regression is a test of independence or a test of goodness of fit.

Last edited: