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?
Asked
Active
Viewed 5,393 times
4
WhiteGirl
- 487
- 1
- 7
- 16
-
1@Scortch, from your link,I didn't find any answer correspond to my question – WhiteGirl Jul 07 '17 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. – Scortchi - Reinstate Monica Jul 07 '17 at 11:39
-
1If possible, you can close this question rather than redirect to a evasive answer. And, you can see that question has no selected answer. – WhiteGirl Jul 07 '17 at 12:20
-
I'd agree with @WhiteGirl that the "duplicate question" doesn't have a satisfactory answer and also asks slightly different questions. – steviesh Jan 30 '18 at 19:35
1 Answers
2
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
Łukasz Deryło
- 4,051
- 1
- 14
- 29
-
-
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? – WhiteGirl Jul 07 '17 at 05:53
-
I am not sure whether there's a authoritative standard for test selection – WhiteGirl Jul 07 '17 at 05: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... :) – Łukasz Deryło Jul 07 '17 at 06:02