How to Calculate G-Test of Goodness of Fit?

The G-Test of Goodness of Fit is a statistical test that can be used to compare observed and expected frequencies in a categorical data set. The G-test measures how well the observed frequencies fit the expected frequencies and is calculated by taking the sum of the squared differences between the observed and expected frequencies, and dividing them by the expected frequencies. The higher the G-test statistic, the less likely it is that the observed and expected frequencies are the same.


A G-test of Goodness of Fit is used to determine whether or not a categorical variable follows a hypothesized distribution.

To perform a G-test of Goodness of Fit, simply enter a list of observed and expected values for up to 10 categories in the boxes below, then click the “Calculate” button:

Category Observed Expected
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Category 8

G Test Statistic: 10.337194

p-value: 0.005693

x