[ a good description of how to arrange a 2x2 table and ... ]
Here's a noddy awk program which computes the stat:
anybody who wants C-code for this test can go to my web page for a
copy. to get there, leap to http://crl.nmsu.edu/ and then burrow
under Research Faculty and Staff, and follow the quick vita to my
page.
the code there will compute the G^2 statistic for any size table as
well as doing a few other things (such as pearson's chi^2 test, mutual
information and computing the significance of a score). other code in
the package will do tokenization, word or n-gram counting, frequency
comparisons, letter and word n-gram formation and so on.
if anybody makes use of this software, i would appreciate it if you
drop me a note describing whether it helped you and what you were
trying to use it for.
i hope this helps.