# Nonparametric chi-square test

I have two independent populations (up and down), each population contains three categories 1,0,-1.

For example:

     up = 1,1,1,1,0,0,1,1,-1,-1,1
down = 1,-1,1,-1,0,1,-1


These populations are not the same size as each other and are much larger than the example above (around 3,000 datapoints)

I want to know how similar these two distributions are to one another (distribution meaning density of -1,0,1)

When I graph these points the data is not normal so I am unable to run a chi-square test.

• A chi-square test does not require normality. In fact, it's almost impossible for a chi-square test of this type to involve normally distributed data. – Peter Flom Oct 10 '12 at 21:10
• Why would you expect that a three-class response variable follows a Gaussian distribution? How does this theoretical distribution relate to the question at hand? – chl Oct 10 '12 at 21:11
• I was under the impression a chi-square test required a normal distribution. Would if be okay then to use a chi-square test on the data above? – gina turco Oct 10 '12 at 21:19
• Are categories ordered? – Miroslav Sabo Oct 10 '12 at 21:22
• The ordinary chi-square test of homogeneity - while usable in this situation - won't take account of the additional information in the ordering. – Glen_b Oct 10 '12 at 21:42

## 1 Answer

It is important to note, that there is a lot of chi squared tests. Most of the comments above are obviously referring to Pearson's chi squared test of independence. Among many others there is also an obsolete chi squared test for comparing two histograms.

This test takes advantage of the fact, that when the beans of the histogram position is fixed, the distribution of data in each bean has Poisson's distribution, which for large numbers (i.e. > 5 or 10) can be approximated with normal distribution. If we take a difference of two such variables coming from the same beans, divide it by the standard deviation (which is known for Poisson's distribution and a little math), square it and sum over all beans we get a statistic, that should behave as chi squared.

But this procedure is obsolete, because it lacks power. (And usually, but not here, depends on arbitrary position of histrograms' beans).

When I graph these points the data is not normal so I am unable to run a chi-square test.

The data is hardly on interval scale, so why should you? And you shouldn't care. As I understand, the 0 value in "between" -1 and 1, so what you have is an ordinal variable, and the question about the shape of its distribution is meaningless.

I want to know how similar these two distributions are to one another (distribution meaning density of -1,0,1)

When you are interested only of the strength of the relationship between those two groups, the easiest to do is to compute Pearson's correlation coefficient. (Because of the way you coded your variable, it will be equivalent to Spearman's rho). Make two columns. One column should contain group membership: 1 for samples from population "up", and 2 for samples from population "down". The other column should contain the actual data (-1s, 0s and 1s) from the corresponding groups. Then compute the correlation between them.

BTW, The best power for testing for difference of two independent groups of the same ordinal variable can be obtained with Wilcoxon-Mann-Whitney test, but it is not what you ask.