The so-called G-test is, in fact, almost identical to the chi-square test for contingency tables. The difference is in the way in which the statistic is computed. The G-test was somewhat awkward to calculate before the era of calculators and spreadsheets, but is recommended as preferable to the chi-square test which is simply an approximation to the G-test for convenient manual computation.
In the chi-square test the statistic is computed as:
whereas is the G-test it is computed as:
The G-test is obtained using maximum likelihood methods and differs from the chi-square measure by terms of the order of 1/√n. In the example provided in the chi-square test section, that of nutrition and IQ levels, the chi-square statistic yielded a value of 9.75 whereas the G-statistic value is 10.51, i.e. larger, hence suggesting the effects are even more significant than the chi-square test indicates.