I would like to know if there is any package and how to use it about sample size calculation for binomial distribution. I have to sample fruits in three fields and I have to count the number of defects. I would like to know how many fruits i have to sample for each field taking in account that i would like to see a difference from 1 to 4% of defects.Alpha .05, power .90
I'm not sure how the three fields fit into your question, but the power.prop.test()
function does power calculations for differences in proportions. It looks like you would need about 600 samples per group to tell the difference between a 1% and a 4% incidence with 90% power ...
power.prop.test(p1=0.01,p2=0.04,power=0.9,sig.level=0.05)
## Two-sample comparison of proportions power calculation
## n = 567.0721
## p1 = 0.01
## p2 = 0.04
## sig.level = 0.05
## power = 0.9
## alternative = two.sided
## NOTE: n is number in *each* group