Biology, images, analysis, design...
|"It has long been an axiom of mine that the little things are infinitely the most important" |
Goodness-of-fit tests for categorized data Pearson's chi square and likelihood ratio G-testOn this page: Principles Pearson's chi-square goodness of fit test Likelihood ratio G-test Assumptions
These goodness of fit tests are designed to test the null hypothesis that an observed frequency distribution is consistent with a hypothesized or theoretical distribution. Pearson's chi square test is the oldest and most frequently used goodness of fit test. The likelihood ratio G-test is an alternative method which has been strongly advocated in recent years. The tests are primarily intended for categorical or discrete variables. They can be used for measurement variables (for example testing the fit of data to a normal distribution), but this results in a loss of information - and can be horribly biased - because the data must first be collapsed into class intervals (categories).
Although the test statistics are calculated in a different way for the two tests, in both cases the statistic approximates to the χ2 distribution in the asymptote. The number of degrees of freedom depends on whether the expected distribution is completely specified - for example an expected ratio of 9:3:3:1 of frequencies of phenotypic forms based on genetic theory - or whether parameters are estimated from the sample - for example an omnibus test of normality.
If the theoretical distribution is completely specified, the number of degrees of freedom is given by:
If parameters of the theoretical distribution are estimated from the sample, the number of degrees of freedom is (approximately) given by:
Note that this latter expression is only an approximation, and tends to reduce the number of degrees of freedom excessively, making the test too conservative. The distribution of the statistic lies somewhere between a chi square distribution with and without the number of estimated parameters subtracted.
Pearson's chi square goodness of fit test
The test statistic - X2 - can be calculated from the following general formula:
For more than two classes no continuity correction is required.
For the special case of two classes, some statisticians feel that a correction for continuity should be applied if the overall number of observations (n) lies between 25 and 200. Other statisticians acknowledge that such a correction makes the test excessively conservative. Yates' correction to the general formula is achieved by subtracting 0.5 from the modulus of each difference between observed and expected values. If there are only two classes, and n is less than 25, the exact binomial
Likelihood ratio G-test
The likelihood ratio G-statistic provides an asymptotically equivalent alternative to Pearson's X2. It can be obtained from the following:
For more than two classes no continuity correction is required. For the special case of two classes, some statisticians suggest you use Williams'' "continuity-correction", the 2x2 version of which is given in
In some circumstances the P-value obtained using this statistic is somewhat closer to that obtained using the exact multinomial.