[R] Proper power computation for one-sided binomial tests.

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Sep 23 23:57:36 CEST 2008


Collin Lynch wrote:
> Hi, I trying to determine the best way to compute the power for a
> one-sample one-sided binomial test.  Specifically I need to sample a
> population of individuals and ask whether a sample rate of 0% is
> compatable with a minimum threshold of 3% and how many samples are needed.
>
> I have made use of power.prop.test but I am not sure if a) that is the
> correct (or best) function to use and b) if the output is quite right.
>
> Here is a sample run:
>   
>> power.prop.test(p1=0, p2=0.03, sig.level=0.05, power=0.90,
>>     
> alt="one.sided")
>
>      Two-sample comparison of proportions power calculation
>
>               n = 279.3004
>              p1 = 0
>              p2 = 0.03
>       sig.level = 0.05
>           power = 0.9
>     alternative = one.sided
>
>  NOTE: n is number in *each* group
>
> This is an attempt to test whether a sample of 0% occurrance is compatable
> with an a-priori probability of 3% at the specified significance levels.
>
> My questions are those above, and, as a followup whether the caveat about
> n being the number in each group means that I need to sample twice that
> number in a single group.  I don't believe so but I want to be sure.
>
>   
Yes, that's wrong. Now you can be sure ;-)

For this kind of problem I'd go directly for the binomial distribution. 
If the actual probability is 0, this is essentially deterministic and 
you can look at

 > binom.test(0,99,p=.03, alt="less")

    Exact binomial test

data:  0 and 99
number of successes = 0, number of trials = 99, p-value = 0.04902
alternative hypothesis: true probability of success is less than 0.03
95 percent confidence interval:
 0.00000000 0.02980667
sample estimates:
probability of success
                     0

So you have significance at n=99, which I think we can easily agree is 
less than two times 249....


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list