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
~~~~~~~~~~ - ([EMAIL PROTECTED])              FAX: (+45) 35327907

______________________________________________
R-help@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.

Reply via email to