Skip to content
Prev 86676 / 398513 Next

creating 3-way tables for mantelhaen.test

Taka,

Maybe you did something strange when you "replaced Y1's values ....".
Is the result a 10-level factor?
The following works for me.

x1 <- sample(c("y", "n"), 100, replace = TRUE)
x2 <- sample(c("a", "b"), 100, replace = TRUE)
y  <- sample(1:10, 100, replace = TRUE)
y  <- factor(y)

dat <- data.frame(x1, x2, y)
dat.xt <- xtabs(~ x1 + x2 + y, data = dat)
mantelhaen.test(dat.xt)

Peter Ehlers
Taka Matzmoto wrote: