Solved – Different p-values for Chi squared and Fisher’s Exact R

I'm trying to find whether there's a correlation between two variables using Chi Square test and Fisher's Exact test. I get two different p values when I run Chi Square test and Fisher's Exact test. Which value should I take? Take Chi squared p value and do not reject H0 or take Fisher's Exact p value ad reject H0?
I ran Fisher's Exact test as well because I get the following error msg when I run Chi Squared test.

Contingency table

enter image description here

> chisq.test(ebtable6)      Pearson's Chi-squared test  data:  ebtable6 X-squared = 7.3866, df = 2, p-value = 0.02489  Warning message: In chisq.test(ebtable6) : Chi-squared approximation may be incorrect  > fisher.test(ebtable6)      Fisher's Exact Test for Count Data  data:  ebtable6 p-value = 0.05018 alternative hypothesis: two.sided 

You should not run two different tests. Choose your test first, before you run any tests and preferably before you examine your data values (though it would be permissible to consider the marginal totals).

By looking at both p-values before you decide which to use, you are (quite rightly) open to charges of p-hacking.

Since you're prepared to condition on the margins (you did an exact test after all), you could consider using simulated p-values to deal with the low expected in the (1,1) cell… I just did a million such simulations in R, it only takes a couple of seconds (the chisq.test default of 2000 is a bit small)

(However, you'll still have looked at the p-values… so that issue won't go away)

Similar Posts:

Rate this post

Leave a Comment

Solved – Different p-values for Chi squared and Fisher’s Exact R

I'm trying to find whether there's a correlation between two variables using Chi Square test and Fisher's Exact test. I get two different p values when I run Chi Square test and Fisher's Exact test. Which value should I take? Take Chi squared p value and do not reject H0 or take Fisher's Exact p value ad reject H0?
I ran Fisher's Exact test as well because I get the following error msg when I run Chi Squared test.

Contingency table

enter image description here

> chisq.test(ebtable6)      Pearson's Chi-squared test  data:  ebtable6 X-squared = 7.3866, df = 2, p-value = 0.02489  Warning message: In chisq.test(ebtable6) : Chi-squared approximation may be incorrect  > fisher.test(ebtable6)      Fisher's Exact Test for Count Data  data:  ebtable6 p-value = 0.05018 alternative hypothesis: two.sided 

Best Answer

You should not run two different tests. Choose your test first, before you run any tests and preferably before you examine your data values (though it would be permissible to consider the marginal totals).

By looking at both p-values before you decide which to use, you are (quite rightly) open to charges of p-hacking.

Since you're prepared to condition on the margins (you did an exact test after all), you could consider using simulated p-values to deal with the low expected in the (1,1) cell… I just did a million such simulations in R, it only takes a couple of seconds (the chisq.test default of 2000 is a bit small)

(However, you'll still have looked at the p-values… so that issue won't go away)

Similar Posts:

Rate this post

Leave a Comment