I am curious about the appropriate statistical test to compare the results from a chi-squared proportion test in R.

In the below code, using a chi-squared proportions test in R, it is shown that the difference between "1" Responses for Group A1 and A2 is significant at > 95%. The difference is 90% 1s vs 10% 1s

It is also shown that the difference between "1" Responses for Group B1 and B2 is significant at > 95%. The difference is 80% 1s vs 20% 1s

However, I am now interested in comparing the resulting differences: the difference between Group A1 and A2, against the difference between Group B1 and B2.

What is the most appropriate test of whether the 90%:10% result from comparing Group A1 and A2, is different from the 80%:20% result from comparing Group B1 and B2? Or is there a single test that should pull in all this information at once?

RESPONSE = c(1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,0,0,0)
GROUP = c(rep("Group A1",10),rep("Group A2",10),rep("Group B1",10),rep("Group B2",10))

Data = cbind.data.frame(RESPONSE,GROUP)

#> table(Data)
#         GROUP
#RESPONSE Group A1 Group A2 Group B1 Group B2
#       0        1        9        2        8
#       1        9        1        8        2

#Proportion test Group A1 vs A2
#Proportion Group A1 = 0.9
#Proportion Group A2 = 0.1
#P-Value = 0.001745

#Proportion test Group B1 vs B2
#Proportion Group B1 = 0.8
#Proportion Group B2 = 0.2
#P-Value = 0.02535
  • $\begingroup$ Given the naming convention, do your 4 groups reflect two distinct variables, each with two levels? That is, a variable reflected by A and B and a variable reflect by 1 and 2? If so, conceptualizing this as a 2 by 2 factorial design may make more sense. As such, you could either do a log-linear analysis or more simply a logistic regression model (with main effects A/B and 1/2 and an interaction between the two). $\endgroup$ – dbwilson Apr 9 '18 at 14:43
  • $\begingroup$ FYI, looking at your data, there is no variability between A1/A2 versus B1/B2 (p=.50 for both). Is this your actual data or just fake "test" data? $\endgroup$ – dbwilson Apr 9 '18 at 15:23
  • $\begingroup$ @dbwilson, Thanks very much for your reply, your comments make sense. I wanted to clarify and hear your thoughts again. The groups A1 A2 B1 B2 are simply 4 unrelated groups responding to the same yes/no question. My convention was a bit misleading in this regard. So if there are 4 unrelated groups A B C D. What would be a test for the proportion A/B being the same or different than the proportion C/D? Or is it more appropriate to test all 4 groups simultaneously. $\endgroup$ – Patrick J Apr 11 '18 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.