In base R, the function chisq.test() "performs chi-squared contingency table tests and goodness-of-fit tests".

However, chisq.test() only takes a numeric vector or matrix, and not a three-way (three-dimensional) contingency table.

Is there a similar function for a three-way contingency table (i.e., array) in R?

  • 1
    $\begingroup$ I think you will find the information you need in the linked thread. Please read it. If it isn't what you want / you still have a question afterwards, come back here & edit your question to state what you learned & what you still need to know. Then we can provide the information you need without just duplicating material elsewhere that already didn't help you. $\endgroup$ – gung - Reinstate Monica Dec 7 '16 at 18:58
  • $\begingroup$ Thanks @gung, one question -is the second (not your accepted) answer to the question (that basically says "a three dimensional contingency table is actually pretty much analogue to the standard variant" on the wrong track? $\endgroup$ – Joshua Rosenberg Dec 7 '16 at 19:05
  • $\begingroup$ I would not use that method, @Joshua. If you have a 3-d table, & you only want to know if rows are independent of columns, & don't care about pages, you could use the Cochran Mantel Haenszel test (in R, ?mantelhaen.test). $\endgroup$ – gung - Reinstate Monica Dec 7 '16 at 19:13
  • 1
    $\begingroup$ I wonder if I'm missing your point, but that sounds fine. I would probably use a log linear model for that. $\endgroup$ – gung - Reinstate Monica Dec 7 '16 at 19:45
  • 1
    $\begingroup$ That's a viable new question. But you would need to specify what you want the effect size to measure. $\endgroup$ – gung - Reinstate Monica Dec 17 '16 at 21:00

Browse other questions tagged or ask your own question.