This seems like a newb question, but I just can't figure it out. I'm looking at a 3d contingency table and I want to run analyses on the partial tables. Below is some sample data:
df2 <- data.frame(Gender = c(rep("M", 6), rep("F", 6)), Beliefs = c(rep("Fund", 2), rep("Mod", 2), rep("Liberal", 2), rep("Fund", 2), rep("Mod", 2), rep("Liberal", 2)), Afterlife = c(rep(c("Yes", "No"), 6)), Count = c(252, 43, 274, 47, 226, 100, 420, 50, 415, 50, 273, 83))
df2.tab <- xtabs(Count ~ Beliefs + Afterlife + Gender, data = df2)
Originally, Gender was my Z variable. But I want to compare the partial tables across levels of Beliefs. Sure, I can create an xtabs with Beliefs as my grouping variable, but even then I can't figure out how to select the partial tables (or level of Z) independently so I can find the ORs for each partial table, e.g., using epitools::oddsratio.wald
Thanks much!