Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Concerning the Pearson chi-square test there seems to be a subtle difference between the goodness-of-fit test and the test of independence.

What is confusing is that both tests seem to be calculated in a very similar way.

My question: What is the real difference and how to handle that in practice?

(NB: This is question is related, yet not the same: Test of independence vs test of homogeneity)

share|improve this question
Note chisq.test performs one or the other depending on its arguments - read the manual. – Scortchi Mar 31 '14 at 7:31
@Scortchi: Edited the question accordingly - thank you. – vonjd Mar 31 '14 at 8:25
up vote 3 down vote accepted

1) A goodness of fit test is for testing whether a set of multinomial counts is distributed according to a prespecified (i.e. before you see the data!) set of population proportions.

2) A test of homogeneity tests whether two (or more) sets of multinomial counts come from different sets of population proportions.

3) A test of independence tests is for a bivariate** multinomial, of whether $p_{ij}$ is different from $p_{i}\,p_{j}$.


Sometimes people make the mistake of treating the second case as if it were the first. This underestimates the variability between the proportions. (If one sample is very large the error in treating it as population proportions will be relatively small.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.