10
$\begingroup$

I'm testing independence in an $N \times M$ contingency table. I don't know whether the G-test or Pearson's chi-squared test is better. The sample size is in the hundreds but there are some low cell counts. As stated on the Wikipedia page, the approximation to the chi-squared distribution is better for the G-test than for Pearson's chi-squared test. But I'm using Monte Carlo simulation to compute the p-value, so is there any difference between these two tests?

$\endgroup$
8
$\begingroup$

They are asymptotically the same. They are just different ways of getting at the same idea. More specifically, Pearson's chi-squared test is a score test, whereas the G-test is a likelihood ratio test. To get a better sense of those ideas, it may help you to read my answer here: Why do my p-values differ between logistic regression output, chi-squared test, and the confidence interval for the OR? To answer your direct question, if you are computing the p-value by Monte Carlo simulation, it shouldn't matter; you could just use whichever is more convenient for you. Note that there is no problem with low cell counts, only (potentially) low expected cell counts; it is possible to have low cell counts and have expected counts that are just fine. Furthermore, neither low actual counts nor low expected counts matters when the p-value is determined by simulation.

(For what it's worth, I would probably use Pearson's chi-squared, because R has a convenient function for that which includes the option of simulating the p-value.)

$\endgroup$
  • $\begingroup$ what is the function in R? $\endgroup$ – llewmills Feb 20 '18 at 1:50
  • $\begingroup$ @llewmills, chisq.test. $\endgroup$ – gung Feb 20 '18 at 2:37
1
$\begingroup$

Have a look at Rfast. https://cran.r-project.org/web/packages/Rfast/index.html The relevant commands are g2Test_univariate(data, dc) g2Test_univariate_perm(data, dc, nperm) The calculations are extremely fast. And in general prefer the G^2 test as the Chi-square is an approximation to it.

$\endgroup$
0
$\begingroup$

Chi-square test and G-test usually produce similar results. But the most important thing here is you have to pick one of two tests and stick with it, not only for your mentioned test but for future tests during the course of your research. It is advisable because if you try to use both tests interchangeably, it is very likely that you will increase the chance of getting false positive.

$\endgroup$
  • $\begingroup$ What is the reasoning by which the claim that the chance of a false positive is increased? (Unless you meant to suggest the test is chosen by reference to the actual counts - but then it's the referring to the counts to choose between them that's the problem, rather than the idea of potentially swapping tests per se) $\endgroup$ – Glen_b Aug 9 '16 at 8:16
  • 2
    $\begingroup$ @Glen_b Chance of getting False Positive likely increases if we choose a p-value of the test that is more favorable to our assumptions (in case we try both tests) $\endgroup$ – little_monster Aug 10 '16 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.