Function G-Test
(
g-test < contingency-table > &optional < expected-value-matrix > < error-p > )
Calculates the G-test for a contingency table. The formula for the
G-test statistic is
2 * sum[f_ij log [f_ij/f-hat_ij]]
where f_ij is the ith by jth cell in the table and f-hat_ij is the
expected value of that cell. If an expected-value-matrix is supplied,
it must be the same size as table and it is used for expected values,
in which case the G-test is a test of goodness-of-fit. If the
expected value matrix is unsupplied, it is calculated from using the
formula
e_ij = [f_i* * f_*j] / f_**
where f_i*, f_*j and f_** are the row, column and grand totals
respectively. In this case, the G-test is a test of independence. The degrees of freedom is the same as for the chi-square statistic and the significance is obtained by comparing