# What's the usage difference between G test and Chi-square test? [duplicate]

These 2 tests are both test hypothesis that proportions are the same in different nominal variables.
In R, you can find GTest() and chisq.test() for these 2 tests.
Then, when should use G test? When should use Chi-square test?

• @Scortch, from your link,I didn't find any answer correspond to my question Jul 7, 2017 at 11:33
• See @gung's answer there, & more details on the differences between score & likelihood-ratio tests by following the link within that answer. Jul 7, 2017 at 11:39
• If possible, you can close this question rather than redirect to a evasive answer. And, you can see that question has no selected answer. Jul 7, 2017 at 12:20
• I'd agree with @WhiteGirl that the "duplicate question" doesn't have a satisfactory answer and also asks slightly different questions. Jan 30, 2018 at 19:35

Both these tests use statistics that are approximately chi-squared-distributed. The larger sample, the better approximation.

If your sample is reasonably large G test and chi-square test behave similarly. But with small samples, G test is better. It's statistic follows distribution that is closer to chi-square distribution than chi-square test's distribution, so calculation of p-value is more acurate.

The obvious question is "How small is small sample?". You can find plenty of definitions, rules of thumb and advices in textbooks. Two, I see most otfen are:

• sample is small, when in contingency table, we have at least one cell with observed count less than 5
• sample is small, when in contingency table, we have at least one cell with expected count less than 5.

The latter is used in chisq.test(). If it is met R warns about possible approximation problem:

> chisq.test(cbind(c(2,3), c(4,5)))

Pearson's Chi-squared test with Yates' continuity correction

data:  cbind(c(2, 3), c(4, 5))
X-squared = 3.8347e-32, df = 1, p-value = 1

Warning message:
In chisq.test(cbind(c(2, 3), c(4, 5))) :
Chi-squared approximation may be incorrect

• If cell count less than 5, should use fisher test? Jul 7, 2017 at 5:51
• If Gtest is better than chisq test. Why G test is seldom mentioned in lots of statistic books?Why chisq test listed in R stats package? Jul 7, 2017 at 5:53
• I am not sure whether there's a authoritative standard for test selection Jul 7, 2017 at 5:54
• I'm not sure too. I just say, R uses it. Fisher test is OK, when your sample is not very large, and contingency table don't have many cells. Otherwise you'll run out of memory fast. Try fisher.test(cbind(c(12,34,123), c(94,51,321), c(123,456,789))) and see what happens. And why G test is seldom mentioned? That's a question... :) Jul 7, 2017 at 6:02