[R] sample size 2-sample proportion test

Berta ibanez at bioef.org
Tue Apr 17 14:10:47 CEST 2007

Hi R-users,
I want to calculate the sample size needed to carry out a  2-sample 
proprotion test (with alfa=0.05, beta=0.8)

1.- probability of success in subpopulation A: 0.8
2.- probability of success in subpopulation B: 0.05
3.- percentage of population in subpopulation A = 5%,
4.- percentage of population in subpopulation B= 95% (the rest, A and B 
(Note that it is dificult to find people from subpopulation A)

Using library(Hmisc) (or others if exist?), I would like to know which one 
of these three options (if any) should I use:

bsamsize(p1=0.8, p2=0.05, fraction=0.05, alpha=.05, power=.8)
#        n1        n2
# 1.46       27.82

samplesize.bin(alpha=0.05, beta=0.8, pit=0.8, pic=0.05, rho=0.05)
#  n= 42

# THIRD: To calculate sample size assuming fraction=0.5 and then multiplying 
by 0.05:
bsamsize(p1=0.8, p2=0.05, fraction=0.5, alpha=.05, power=.8)
#     n1      n2
 # 5.47 5.47
# so that  n=6*100/5=120

Taking into account the difficulty of obtaining the samples, which method 
would be recomended? Or in other words, how many people should I find, 
around 30-40 or 120?

Thanks a lot in advance,


More information about the R-help mailing list