[R] prop.test or chisq.test ..?

Dylan Beaudette dylan.beaudette at gmail.com
Tue Feb 27 02:36:30 CET 2007


Hi everyone,

Suppose I have a count the occurrences of positive results, and the total 
number of occurrences:


pos <- 14
total <- 15

testing that the proportion of positive occurrences is greater than 0.5 gives 
a p-value and confidence interval:

prop.test( pos, total, p=0.5, alternative='greater')

        1-sample proportions test with continuity correction

data:  14 out of 15, null probability 0.5 
X-squared = 9.6, df = 1, p-value = 0.0009729
alternative hypothesis: true p is greater than 0.5 
95 percent confidence interval:
 0.706632 1.000000 
sample estimates:
        p 
0.9333333


My question is how does the use of chisq.test() differ from the above 
operation. For example:

chisq.test(table( c(rep('pos', 14), rep('neg', 1)) ))

        Chi-squared test for given probabilities

data:  table(c(rep("pos", 14), rep("neg", 1))) 
X-squared = 11.2667, df = 1, p-value = 0.0007891

... gives slightly different results. I am corrent in interpreting that the 
chisq.test() function in this case is giving me a p-value associated with the 
test that the probabilities of pos are *different* than the probabilities of 
neg -- and thus a larger p-value than the prop.test(... , p=0.5, 
alternative='greater') ? 

I realize that this is a rather elementary question, and references to a text 
would be just as helpful. Ideally, I would like a measure of how much I 
can 'trust' that a larger proportion is also statistically meaningful. Thus 
far the results from prop.test() match my intuition, but affirmation would be 
great.

Cheers,


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



More information about the R-help mailing list