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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Sep 25 20:51:27 CEST 2008

```Johannes Hüsing wrote:
>
> Am 23.09.2008 um 23:57 schrieb Peter Dalgaard:
>
>> 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")
>>
>
> This means that you don't sample from the p=.03 population?
> Note that there is a 5 per cent chance to have 0 failures in 99
> trials with p=.03.
Yes, that's what I read the task as saying: Sample from p=0.00 when the
hypothesis is p=0.03. Then rejection happens with probability 1 when n
>= 99. Actually, he said that we could assume the _sample_ rate to be
0%, but that is only assured when p=0.0.

(You can continue the game by looking at the probability of getting 0
failures, depending on the true p. E.g., if p=0.001, we have

> dbinom(0, 99, 0.001)
 0.9056978

i.e. 90% power to detect at 5% level. And further continue into a full
power analysis where you calculate the probability of a failure rate
that is significantly different from 0.03 depending on p and n.)

--
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

```