Re: [R] About continuity correction option in the mantelhaen.test function.

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Thu, 20 Nov 2008 09:42:56 +0100

Paek, Insu wrote:
> Hello,
> I was using the mantelhaen.test function (2x2 J tables for
> conditional independence testing). I noticed that the option for the
> continuity correction (correction=T or correction=F) sometimes made a
> difference while sometimes it did give the same results regardless of
> correction=T or correction=F.
>
> Does the continuity correction apply only in certain cases or in
> certain strata with some rules ?
> Could you let me know why I am seeing no difference sometimes
> regardless of correction=T or F ?

An example would help...

According to the code, the continuity correction is turned off if DELTA < 0.5, so you should see it only in cases where the p-value is close to 1. However, the output should say so:

             DELTA <- abs(sum(x[1, 1, ] - s.x[1, ] * s.y[1, ]/n))
             YATES <- ifelse(correct && (DELTA >= 0.5), 0.5, 0)
             STATISTIC <- ((DELTA - YATES)^2/sum(apply(rbind(s.x,
                 s.y), 2, prod)/(n^2 * (n - 1))))
....
             METHOD <- paste("Mantel-Haenszel chi-squared test",
                 ifelse(YATES, "with", "without"),
                               "continuity correction")

What worries me more is that it seems that 'alternative' is being ignored in the !exact case:

 > mantelhaen.test(UCBAdmissions,alt="l")$p.value [1] 0.2322635
 > mantelhaen.test(UCBAdmissions)$p.value [1] 0.2322635
 > mantelhaen.test(UCBAdmissions,exact=T)$p.value [1] 0.2277625
 > mantelhaen.test(UCBAdmissions,exact=T, alt="l")$p.value [1] 0.1159937

-- 
    O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 20 Nov 2008 - 08:45:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Nov 2008 - 09:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive