G-test

From Free net encyclopedia

(Difference between revisions)
Revision as of 20:34, 5 April 2006
TimBentley (Talk | contribs)
Disambiguation link repair - [[Wikipedia:Disambiguation pages with links|You can help!]]
Next diff →

Current revision

In statistics, G-tests are likelihood-ratio or maximum likelihood statistical significance tests that are increasingly being used in situations where chi-square tests were previously recommended.

The commonly used chi-squared tests for goodness of fit to a distribution and for independence in contingency tables are in fact approximations of the log-likelihood ratio on which the G-tests are based. This approximation was developed by Karl Pearson because at the time it was unduly laborious to calculate log-likelihood ratios. With the advent of electronic calculators and personal computers, this is no longer a problem. G-tests are coming into increasing use, particularly since they were recommended in the 1994 edition of the popular statistics text book by Sokal and Rohlf.

The general formula for Pearson's chi-squared test statistic is

<math> \chi^2 = \sum_{i} {(O_i - E_i)^2 \over E_i}</math>
where Oi is the frequency observed in a cell, E is the frequency expected on the null hypothesis, and the sum is taken across all cells. The corresponding general formula for G is
<math> G = 2\sum_{i} {O_i \cdot \ln(O_i/E_i) }</math>
where ln denotes the natural logarithm (log to the base e) and the sum is again taken over all cells.

On the null hypothesis that the observed frequencies result from random sampling from a distribution with the given expected frequencies, the distribution of G is approximately that of chi-squared, with the same number of degrees of freedom as in the corresponding chi-squared test.

For samples of a reasonable size, the G-test and the chi-squared test will lead to the same conclusions. However, the approximation to the theoretical chi-square distribution for the G-test is better than for the Pearson chi-squared tests in cases where for any cell |OiEi | > Ei, and in any such case the G-test should always be used.

For very small samples the multinomial test for goodness of fit, and Fisher's exact test for contingency tables, are preferable to either the chi-squared test or the G-test.

Statistical Software

  • Software for the R programming language [1] to perform the G-test is provided by here by Pete Hurd.
  • Fisher's G-Test in the GeneTS Package of the R programming language (fisher.g.test) does not implement the G-test as described in this article, but rather Fisher's exact test of Gaussian white-noise in a time series (see Fisher, R.A. 1929 "Tests of significance in harmonic analysis").

References

  • Sokal, R. R., & Rohlf, F. J. (1994). Biometry: the principles and practice of statistics in biological research., 3rd edition. New York: Freeman. ISBN 0-7167-2411-1.