Can I use a chi-squared test to compare two empirical distributions?

Signs point to "yes." R's chisq.test allows two vectors x and y. It says:

cases with missing values are removed, the objects are coerced to factors, and the contingency table is computed from these. Then Pearson's chi-squared test is performed of the null hypothesis that the joint distribution of the cell counts in a 2-dimensional contingency table is the product of the row and column marginals.

See also: same question about KS test.

  • $\begingroup$ Certainly, if the distributions are ones that should be compared with chi-square. $\endgroup$
    – Peter Flom
    Dec 24, 2013 at 20:23
  • $\begingroup$ Can you point to a crisp definition? $\endgroup$
    – dfrankow
    Dec 24, 2013 at 23:52
  • 1
    $\begingroup$ If the other conditions hold, sure, though if the categories are anything but nominal it's not an especially powerful test. Are you talking about distributions of counts? Independent observations? $\endgroup$
    – Glen_b
    Dec 25, 2013 at 1:20
  • $\begingroup$ Distributions of counts. For example, we sit on the street and tag each person walking by green or red by flipping a (fair) coin. The counts I want to compare are the number of green people and number of red people per day for multiple days, to see if the coin is fair. $\endgroup$
    – dfrankow
    Dec 26, 2013 at 3:04

1 Answer 1


The chi-square test of homogeneity of proportions can be used to compare two sets of multinomial proportions over the same set of values. In that sense it can be thought of as a two-sample equivalent (or indeed more than two-) of the chi-squared goodness of fit test (in a similar sense to the way a two-sample Kolmogorov-Smirnov test relates to a one-sample test).

In short, yes, provided the conditions for the test to be suitable all hold to a sufficient-for-your-purposes approximation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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