[R] Yates' correction

Frank E Harrell Jr fharrell at virginia.edu
Thu Nov 21 01:41:38 CET 2002


On Wed, 20 Nov 2002 21:51:56 +0000
Peter Ho <peter at fe.up.pt> wrote:

> Dear list readers,
> 
> This question is concerned with the use of the chisq.test() in R.
> A test was conducted to determine the difference between 2 samples A and 
> B. Column I consisted of correct and incorrect assessment of  30 matched 
> pairs (AA or BB) , whereas column II consisted of correct and incorrect 
> assessment of  30 unmatched pairs (AB or BA). This example is given in a 
> book on the sensory evaluation techniques. The author's did not use 
> used when analysing a 2x2 contigency table using the chi-square test. I 
> have found conflicting views in literature with some people for and 
> conflicting results.
> 
>  > x <- matrix(c(17, 13, 9, 21), nc = 2)
>  > chisq.test(x,correct = TRUE)
> 
>         Pearson's Chi-squared test with Yates' continuity correction
> 
> data:  x
> X-squared = 3.3258, df = 1, p-value = 0.0682
> 
>  > chisq.test(x,correct = F)
> 
>         Pearson's Chi-squared test
> 
> data:  x
> X-squared = 4.3439, df = 1, p-value = 0.03714
> 
>  >
> 
> The same data analysed using Fisher's exact test is similar to the 
>  > fisher.test(x)
> 
>         Fisher's Exact Test for Count Data
> 
> data:  x
> p-value = 0.06728
> alternative hypothesis: true odds ratio is not equal to 1
> 95 percent confidence interval:
>   0.9354766 10.1716022
> sample estimates:
> odds ratio
>   2.992580
> 
> I suppose looking at the results, the correct conclusion should be taken 
> using the correction for continuity. In fact, the statistics books I 
> example, Nonparametric statistics - Sidney Siegel and John Castellan 1988)
> 
> I would like to hear anyone's view on this, especially statisticians.
> 
> 
> Thanks in advance
> 
> Peter
> ----------------------------------
> ISR-Porto

In general you use Yates' correction if you want the results to be conservative as with Fisher's "exact" test.  I generally use the chi-square test without continuity correction.  The price of "exact" tests (those that guarantee the type I error is no greater than a set value) is conservatism.  I prefer tests that get closest to the target alpha value even if they exceed it a little bit on occasion.

This kind of question would be slightly more appropriate for the sci.stat.consult Usenet news group.
-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list