# Chi Square for this case?

I am not sure how to perform the statistical analysis on the following table.

I did an experiment in which 12 participants had to choose between 3 conditions when provided with 3 stimuli.

  Stimulus  Condition1  Condition2 Condition 3
A            9          1          2
B           10          2          0
C            8          2          2


I want to prove that it is not by chance that Condition 1 is preferred rather than the other two conditions. How can I do this analysis? Maybe with a Chi Square test? If yes should I group Condition 2 and 3 against Condition 1?

I use R, in case could you please provide an R example in order to analyze these data?

It is inappropriate to use Chi-square or Fisher exact test for contingency table here because the rows of the table (stimuli) are not independent: the same sample of 12 subjects constitutes each of the rows.

If you want to test that condition1 is chosen significantly more often than the other two combined you should apply binomial test with null hypothesis that proportion for condition1 is 0.5 and the alternative hypothesis that it is >0.5. Three such independent tests - one for each stimulus.

• Thanks a lot. Actually I want to know if globally the Condition 1 is chosen significantly more often than the other two combined, I mean considering all the stimuli. Can I simply do the binomial analysis summing together the values of the conditions separately (i.e. 27 vs 9)? Or are there some issues with the multiple comparisons? – L_T Dec 3 '11 at 1:16
• Formally you can (despite that each respondent will be represented 3 times, making the design hierarchical). But I'd advice to do a separate test for each stimulus. They are something different. Why make a hodge-podge? – ttnphns Dec 3 '11 at 8:33
• Because I need to know if GLOBALLY condition 1 is better, I don't want to know only the significance at stimulus level. Indeed I will have more than 3 stimuli in the real table I use. What do you mean with "making the design hierarchical"? Can you provide an example in R please, so I can understand what do you mean? – L_T Dec 3 '11 at 14:16

I believe that the $X^2$ test is not appropriate because the some of expected cell counts < 5. Thus, you might need to use the Fisher's exact test.

a = matrix(data= c(9,10,8,1,2,2,2,0,2), 3,3)
> fisher.test(a)

Fisher's Exact Test for Count Data

data:  a
p-value = 0.6743
alternative hypothesis: two.sided


Since the p-value > 0.05. Thus, we can conclude that Stimulus and Conditions are independent at a 5% level. This means that there is no preference for stimulus.

• Thanks a lot for your answer. The thing is that I don't want to check if a stimulus is preferred rather than an other. Instead I want to know if a Condition is preferred compared to the other two. How can I do this? Should I just swap the Stimulus and Condition, so I get the trasposed version of the matrix? – L_T Dec 2 '11 at 10:14
• I have upvoted this reply because it represents a useful first step: Tu.2's analysis provides justification for aggregating the results over all stimuli. This reduces your dataset to the three numbers (27, 5, 4): you would like to know whether such an extreme discrepancy (27 vs 5+4) could occur by chance. This is a much more straightforward question (with an answer that I hope is obvious!). – whuber Dec 2 '11 at 14:39
• No, it is not obvious at least for me. Do you mean I should use a binomial distribution? Could you please let me know what is your suggestion? – L_T Dec 2 '11 at 16:43
• You could use the "simultaneous confidence interval" for multiple proportions. Please refer to Agresti et al. (2008) Simultaneous confidence intervals for comparing binomial parameter Biometrics 64, 1270-1275. This article should be able to answer your question. – Tu.2 Dec 3 '11 at 14:51
• Hi, I have opened a specific topic on this argument, please have a look here: stats.stackexchange.com/questions/19537/… – L_T Dec 8 '11 at 18:29