# What are the requirements for Pearson's chi-squared test of homogeneity?

Let us assume I want to compare men and women in their preference of four kinds of foods. I invite everyone who is interested into the lab and ask them: "Which food do you prefer? Apple, orange, pizza, or beer? Choose only one food."

My survey will result in a contingency table like the following, which I can then test with a chi-squared test of homogeneity to find, whether there are differences in food choice between men and women:

     choice
group apple orange pizza beer
men   374     63   216  101
women   510     65   125   76


I can use the chi-squared test, because the samples are independent.

Now, let us assume that I invite all the participants into the lab again every day for one month and ask them the same question. My survey will reslult in a similar contingency table to the first one, and the samples (men versus women) will still be independent. The difference is that now I have repeated measures.

I have always understood that the requirements for independence are broken if there are repeated measures between samples, for example in a pre-post comparison. But in my example, the samples (men and women) are still independent. The dependence is within a sample.

So my question is:

Does my second example still meet the requirements of a chi-squared test of homogeneity?

• Just because you're asking separate people doesn't mean the subject's responses are independent. Independence may be a reasonable assumption but there's nothing inherent in the design itself that guarantees independence. – Glen_b Aug 23 '17 at 10:22
• @Glen_b So you are saying that even in the first example (without repeated measures) independence cannot be certain and I therefore cannot perform a chi-squared test? That seems strange, as that is a common example for when the chi-squared test may be applied. Could you maybe explain when a chi-squared test can be applied (for groups of people)? – user167929 Aug 23 '17 at 11:19
• While I agree that you cannot be certain you have independence, I didn't say that you cannot perform a chi-squared test; in fact I clearly said something different from that and I cannot see how you read that into what I wrote. I said above "it may be a reasonable assumption" -- such assumptions are commonly made and I usually wouldn't have any major qualms about making that assumption in typical situations (as the one you describe sounds like it may be) -- but you should be clear in your own mind that you're making an assumption, not reporting a fact. – Glen_b Aug 23 '17 at 16:06
• One can of course explain why one thinks that assumption is reasonable -- generally there's no obvious mechanism by which people selected at random from some given population would have dependence in their preferences for example, so in those circumstances the assumption would be hard to challenge, but imagine that someone happens to let slip to a room full of waiting participants what the task is ... and then a few participants start chatting loudly about how great pizza is ... then you run your experiment, not realizing that the opinions of your sample have been influenced – Glen_b Aug 23 '17 at 22:48