Wikipedia
G-test
In statistics, G-tests are likelihood-ratio or maximum likelihood statistical significance tests that are increasingly being used in situations where chi-squared tests were previously recommended.
The general formula for G is
$$G = 2\sum_{i} {O_{i} \cdot \ln\left(\frac{O_i}{E_i}\right)},$$
where O is the observed count in a cell, E is the expected count under the null hypothesis, ln denotes the natural logarithm, and the sum is taken over all non-empty cells.
G-tests have been recommended at least since the 1981 edition of the popular statistics textbook by Robert R. Sokal and F. James Rohlf.