Solved – use a chi-squared test to compare two empirical distributions

chi-squared-testhypothesis testing

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.

Best Answer

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.