Hello, I cannot understand a result given by the mantelhaen.test() in one-sided tests. You will find below the code that gives the strange result. I do not have this for the fisher.test() function. Thanks in advance for the comment. Best, Gael M. ## Creation of the table obs3 tempo <- list(c("Non", "Oui"), c("Oui", "Non"), c("Jaune", "Jaune.rouge", "Rouge")) names(tempo) <- c("Verse", "Attaque", "Couleur") obs3 <- as.table(array(c(13, 12, 7, 16, 12, 2, 3, 5, 11, 4, 11, 3), dim = c(2, 2, 3), dimnames=tempo)) addmargins(obs3) ## Lower-tailed test : the common odds ratio is 2.315991 and the p-value 0.9765 mantelhaen.test(obs3, exact=FALSE, correct=FALSE, alternative="less") ## Computation of the Z statistic and p value n1.z <- margin.table(obs3[1,,],2) n.1z <- margin.table(obs3[,1,],2) n.2z<- margin.table(obs3[,2,],2) nz <- margin.table(obs3,3) t11z <- n1.z*n.1z/nz n11z<-obs3[1,1,] n12z<-obs3[1, 2,] n21z<-obs3[2,1,] n22z<-obs3[2, 2,] n1.z<- margin.table(obs3[1,,],2) n2.z<- margin.table(obs3[2,,],2) Zcalc<-sum(n11z - t11z) / (sum(n1.z * n2.z * n.1z * n.2z / (nz^2 * (nz-1))))^0.5 ## The Z statistic is identical to mantelhaen.test() Zcalc Zcalc^2 ## The p-value is identical to mantelhaen.test() pnorm(Zcalc) ## The common odds ratio is identical to mantelhaen.test() odd<-sum(n11z*n22z/nz)/sum(n12z*n21z/nz) odd ## Now I switch lines values in each 2 x 2 table obs3[2:1,,]<-obs3[1:2,,] ## I restart the same code after addmargins(obs3), it is still a lower-tailed test ## Results : the common odds ratio is now 0.4317805 but the p-value remains 0.9765 with mantelhaen.test(). Manualy, I found a p-value = 0.02353283 which seems to me ok when I have 0.4317805 as a common odds ratio and when I test "true common odds ratio is less than 1"

I believe this has been fixed in R 2.12.2 patched. See bug 14514. *** This bug has been marked as a duplicate of bug 14514 ***