# [R] significance in difference of proportions: What problem are you solving?

Spencer Graves spencer.graves at pdf.com
Thu Nov 27 18:51:34 CET 2003

```Hi, Torsten:

Thanks for the reference to library(exactRankTests).  That seems
like a reasonable alternative to "prop.test" with small samples.

However, aren't "exact tests" and the related bootstrap
methodology what Deming called "enumerative techniques", more relating
to describing a fixed finite population than "enumerative techniques"
for describing more general processes that will likely generate similar
samples in the future?  Don't "exact tests" and bootstraps answer
different ("enumerative") questions from those posed by standard
("analytic") parametric procedures?  (I know that the chi-square
distribution is only an approximation to the distribution of the
contingency table chi-square;  however, that is a different issue from
the question of enumerative vs. analytic studies.)

Thanks again for this and your many other interesting
contributions to r-help.
Spencer Graves

Torsten Hothorn wrote:

>>Hello,
>>
>>I'm looking for some guidance with the following problem:
>>
>>I've 2 samples A (111 items) and B (10 items) drawn from the same unknown
>>population. Witihn A I find 9 "positives" and in B 0 positives. I'd like to
>>know if the 2 samples A and B are different, ie is there a way to find out
>>whether the number of "positives" is significantly different in A and B?
>>
>>I'm currently using prop.test, but unfortunately some of my data contains
>>less than 5 items in a group (like in the example above), and the test
>>statistics may not hold:
>>
>>
>
>The statistic is fine, the approximation to its null distribution may be
>questionable :-)
>
>
>
>
>
>>>prop.test(c(9,0), c(111,10))
>>>
>>>
>>        2-sample test for equality of proportions with continuity correction
>>
>>data:  c(9, 0) out of c(111, 10)
>>X-squared = 0.0941, df = 1, p-value = 0.759
>>alternative hypothesis: two.sided
>>95 percent confidence interval:
>> -0.02420252  0.18636468
>>sample estimates:
>>    prop 1     prop 2
>>0.08108108 0.00000000
>>
>>Warning message:
>>Chi-squared approximation may be incorrect in: prop.test(c(9, 0), c(111, 10))
>>
>>
>>Do you have suggestions for an alternative test?
>>
>>
>>
>
>you may consider a permutation test for two independent samples:
>
>R> library(exactRankTests)
>R> x = c(rep(1, 9), rep(0, 102))
>R> y = rep(0, 10)
>R> mean(x)
> 0.08108108
>R> mean(y)
> 0
>R> perm.test(y, x, exact = TRUE)
>
>        2-sample Permutation Test
>
>data:  y and x
>T = 0, p-value = 0.6092
>alternative hypothesis: true mu is not equal to 0
>
>Best,
>
>Torsten
>
>
>
>
>>	many thanks for your help,
>>	+kind regards,
>>
>>	Arne
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
>>
>>
>>
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>

```