I am hoping to compare proportions from an experiment with a two-by-two factorial design. I use R for my stats.
I know how to compare two proportions, or do an ANOVA-like test on many proportions, by using prop.test.
For example,
num_positive = c(10, 30)
num_total = c(100,180)
prop.test(x = num_positive, num_total)
or for the one-way-ANOVA-like situation:
num_positive = c(10, 30, 80)
num_total = c(100,180, 200)
prop.test(x = num_positive, num_total)
But I don't know how to do this with a two-way situation. prop.test doesn't accept any sort of model structure and the data are proportion data so don't make sense to be analyzed using an ANOVA.
Ideally, I'd want a function that does something like this:
num_positive = c(10, 30, 80, 100)
num_total = c(100,180, 200, 200)
factorA = c("A","A","B","B")
factorZ = c("Z","Y","Z","Y")
prop.test(cbind(num_positive, num_total) ~ factorA * factorZ)
Thanks for any help!