Paek, Insu
2008-Nov-20 03:55 UTC
[R] About continuity correction option in the mantelhaen.test function.
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 ? Thank you so much, Insu ************************************************* Insu Paek Educational Testing Service Rosedale Road MS - 02P Princeton, NJ 08541 (Tel) 609 - 734 - 1450 Email: ipaek@ets.org ************************************************* -------------------------------------------------- This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. -------------------------------------------------- [[alternative HTML version deleted]]
Peter Dalgaard
2008-Nov-20 08:42 UTC
[R] About continuity correction option in the mantelhaen.test function.
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