[R] [FORGED] Yates correction

Rolf Turner r.turner at auckland.ac.nz
Tue Feb 21 23:14:20 CET 2017


On 21/02/17 23:47, Jomy Jose wrote:
>  I tried to do chi square test for the following observed frequencies
> ---------------------------------------------------------------------------------------------
>    A  B
> A  8  4
> B 12 10
>
> R gave the following output:
> -------------------------------------------------------------------------------------------
>         Pearson's Chi-squared test with Yates' continuity correction
>
> data:  M
> X-squared = 0.10349, df = 1, p-value = 0.7477
>
> Warning message:
> In chisq.test(M) : Chi-squared approximation may be incorrect
>
> ---------------------------------------------------------------------------------------------------------------
> Whether this result can be relied or we have to use Fishers exact test ?

(a) With a p-value of 0.7477 there is no evidence against the null 
hypothesis no matter how you slice it.

(b) To assuage your trepidations, use "simulate.p.value=TRUE".

E.g.

    chisq.test(M,simulate.p.value=TRUE,B=9999)

Note that the value of X-squared that is returned is "of course" the 
same as what you'd get by setting correct=FALSE. I got a p-value of 
0.7178; you will get something slightly different, since a simulated 
p-value is random, but it will be about 0.71 or 0.72.

Bottom line:  Don't reject H_0!!!

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list