Dear all,
Although I was not able to sort out the problem of the likelihood (which
any reply would be appreciated), I just a function done by Hurd that
produces exactly the g-test (based on log likelihood ratio).
It can be found here, and it is beautiful:
http://www.psych.ualberta.ca/~phurd/cruft/g.test.r
The results match perfectly, although it does not work with
multidimentional tables (the following example).
Thank you in advance,
Best wishes,
Marta