[R] About continuity correction option in the mantelhaen.test function.
p.dalgaard at biostat.ku.dk
Thu Nov 20 09:42:56 CET 2008
Paek, Insu wrote:
> 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"),
What worries me more is that it seems that 'alternative' is being
ignored in the !exact case:
> mantelhaen.test(UCBAdmissions,exact=T, alt="l")$p.value
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
More information about the R-help