Pearson's chisquare test
From Academic Kids

Pearson's chisquare test (χ^{2}) is one of a variety of chisquare tests – statistical procedures whose results are evaluated by reference to the chisquare distribution. It tests a null hypothesis that the relative frequencies of occurrence of observed events follow a specified frequency distribution. The events must be mutually exclusive. One of the simplest examples is the hypothesis that an ordinary sixsided die is "fair", i.e., all six outcomes occur equally often. Chisquare is calculated by finding the difference between each observed and theoretical frequency, squaring them, dividing each by the theoretical frequency, and taking the sum of the results:
 <math> \chi^2 = \sum {(O  E)^2 \over E}<math>
where:
 O = an observed frequency
 E = an expected (theoretical) frequency, asserted by the null hypothesis
For example, to test the hypothesis that a random sample of 100 people has been drawn from a population in which men and women are equal in frequency, the observed number of men and women would be compared to the theoretical frequencies of 50 men and 50 women. If there were 45 men in the sample and 55 women:
 <math> \chi^2 = {(45  50)^2 \over 50} + {(55  50)^2 \over 50} = 1<math>
There is one degree of freedom in the comparison (since either difference between observed and expected frequencies, once known, dictates the other). Consultation of the chisquare distribution for 1 degree of freedom shows that the probability of observing this difference (or a more extreme difference than this) if men and women are equally numerous in the population is approximately 0.3. This probability is higher than conventional criteria for statistical significance, so normally we would accept the null hypothesis that the number of men in the population is the same as the number of women.
Pearson's chisquare is used to assess two types of comparison: tests of goodness of fit and tests of independence. A test of goodness of fit establishes whether or not an observed frequency distribution differs from a theoretical distribution. A test of independence assesses whether paired observations on two variables, expressed in a contingency table, are independent of each other – for example, whether people from different regions differ in the frequency with which they report that they support a political candidate.
Pearson's chisquare is the original and most widelyused chisquare test.
The null distribution of the Pearson statistic is only approximated as a chisquare distribution. This approximation arises as the true distribution, under the null hypothesis, of the expected value is given by a Binomial distribution:
 <math> E =^d \mbox{Bin}(n,p) <math>
where:
 p = probability, under the null hypothesis
 n = number of observations in the sample
In the above example the hypothesised probability of a male observation is 0.5, with 100 samples. Thus we expect to observe 50 males.
When comparing the Pearson test statistic against a chisquared distribution, the above binomial distribution is approximated as a Gaussian (normal) distribution:
 <math> \mbox{Bin}(n,p) \approx^d \mbox{N}(np, np(1p)) <math>
By definition, a sum of <math>k<math> standard normal variates, <math>Z<math>, is distributed as chisquare with <math>k<math> degrees of freedom:
 <math> \sum_{i=1}^k Z^2_i =^d \chi^2_k <math>
In cases whereby the expected value, E, is found to be small (indicating either a small underlying population probability, or a small number of observations), the normal approximation of the binomial distribution can fail, and in such cases it is found to be more appropriate to use the Gtest, a likelihood ratiobased test statistic. Where the total sample size is small, it is necessary to use an appropriate exact test, typically either the binomial test or (for contingency tables) Fisher's exact test.
See also
External links
 Sampling Distribution of the Sample ChiSquare Statistic (http://statwww.berkeley.edu/~stark/Java/SampleChi.htm) — a Java applet showing the sampling distribution of the Pearson test statistic.it:Test chi quadrato di Pearson