angelo.arcadi at virgilio.it
2011-Dec-08 21:58 UTC
[R] prop.test() and the simultaneous confidence interval for multiple proportions in R
Dear list members, I want to perform in R the analysis "simultaneous confidence interval for multiple proportions", as illustrated in the article of Agresti et al. (2008) "Simultaneous confidence intervals for comparing binomial parameter", Biometrics 64, 1270-1275. If I am not wrong the R function implementing the Agresti et al. method is prop.test(). I ask an help because I have some difficulties in reading the output of that function. As a case study, I need to apply such analysis on the following simple prolbem: 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 My goal is to prove that it is not by chance that Condition 1 is preferred rather than the other two conditions. So, I apply the function prop.test(), summing the values of Conditions 2 and 3): table<-matrix(c(9,3,10,2,8,4),ncol=2,byrow=T) rownames(table)<-c("stimulusA","stimulusB","stimulusC") colnames(table)<-c("Condition1","Conditions2and3")> tableCondition1 Conditions2and3 stimulusA 9 3 stimulusB 10 2 stimulusC 8 4 prop.test(table)> prop.test(table)3-sample test for equality of proportions without continuity correction data: table X-squared = 0.8889, df = 2, p-value = 0.6412 alternative hypothesis: two.sided sample estimates: prop 1 prop 2 prop 3 0.7500000 0.8333333 0.6666667 Warning message: In prop.test(table) : Chi-squared approximation may be incorrect I don't understand where I can deduct that Condition1 is more preferred than Conditions 2 and 3. Should I simply look at the p-value? The fact is that tried with a more extreme example, but the p-value results still above 0.05: This is the table I used:> table2Condition1 Condition2 stimulusA 12 0 stimulusB 10 2 stimulusC 11 1> table2<-matrix(c(12,0,10,2,11,1),ncol=2,byrow=T) > rownames(table2)<-c("stimulusA","stimulusB","stimulusC") > colnames(table2)<-c("Condition1","Condition2") > prop.test(table2)3-sample test for equality of proportions without continuity correction data: table2 X-squared = 2.1818, df = 2, p-value = 0.3359 alternative hypothesis: two.sided sample estimates: prop 1 prop 2 prop 3 1.0000000 0.8333333 0.9166667 Warning message: In prop.test(table2) : Chi-squared approximation may be incorrect Could you please enlighten me? Thanks in advance [[alternative HTML version deleted]]
Jean V Adams
2011-Dec-12 13:34 UTC
[R] prop.test() and the simultaneous confidence interval for multiple proportions in R
?prop.test The very first line in the help file on the function prop.test(): "prop.test can be used for testing the null that the proportions (probabilities of success) in several groups are the same ..." How to interpret the results of the prop.test() you ran? The proportion preferring Condition 1 with stimulus A was 75%, that with B was 83%, and that with C was 67%. Are these three proportions the same? No, X2_2 = 0.89, P = 0.64. A search on-line yielded some "R code to find simultaneous confidence intervals for binomial proportions" based on Agresti et al. (2008). Perhaps you would find that useful. http://www.stat.ufl.edu/~aa/cda/R/multcomp/ryu-simultaneous.pdf Jean angelo.arcadi@virgilio.it wrote on 12/08/2011 03:58:38 PM:> Dear list members, > I want to perform in R the analysis "simultaneous confidence > interval for multiple proportions", as illustrated in the article of > Agresti et al. (2008) "Simultaneous confidence intervals for > comparing binomial parameter", Biometrics 64, 1270-1275. > > If I am not wrong the R function implementing the Agresti et al. > method is prop.test(). I ask an help because I have some > difficulties in reading the output of that function. > > As a case study, I need to apply such analysis on the following > simple prolbem: > > 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 > > My goal is to prove that it is not by chance that Condition 1 is > preferred rather than the other two conditions. > > So, I apply the function prop.test(), summing the values of > Conditions 2 and 3): > > table<-matrix(c(9,3,10,2,8,4),ncol=2,byrow=T) > rownames(table)<-c("stimulusA","stimulusB","stimulusC") > colnames(table)<-c("Condition1","Conditions2and3") > > > table > Condition1 Conditions2and3 > stimulusA 9 3 > stimulusB 10 2 > stimulusC 8 4 > > > prop.test(table) > > > prop.test(table) > > 3-sample test for equality of proportions without continuitycorrection> > data: table > X-squared = 0.8889, df = 2, p-value = 0.6412 > alternative hypothesis: two.sided > sample estimates: > prop 1 prop 2 prop 3 > 0.7500000 0.8333333 0.6666667 > > Warning message: > In prop.test(table) : Chi-squared approximation may be incorrect > > I don't understand where I can deduct that Condition1 is more > preferred than Conditions 2 and 3. > Should I simply look at the p-value? > > The fact is that tried with a more extreme example, but the p-value > results still above 0.05: > This is the table I used: > > > table2 > Condition1 Condition2 > stimulusA 12 0 > stimulusB 10 2 > stimulusC 11 1 > > > table2<-matrix(c(12,0,10,2,11,1),ncol=2,byrow=T) > > rownames(table2)<-c("stimulusA","stimulusB","stimulusC") > > colnames(table2)<-c("Condition1","Condition2") > > prop.test(table2) > > 3-sample test for equality of proportions without continuitycorrection> > data: table2 > X-squared = 2.1818, df = 2, p-value = 0.3359 > alternative hypothesis: two.sided > sample estimates: > prop 1 prop 2 prop 3 > 1.0000000 0.8333333 0.9166667 > > Warning message: > In prop.test(table2) : Chi-squared approximation may be incorrect > > > > Could you please enlighten me? > > > Thanks in advance[[alternative HTML version deleted]]