[R] sample size for 2-sample proportion tests
Berta
ibanez at bioef.org
Tue Feb 27 18:58:48 CET 2007
Hi R-users,
I want to calculate the sample size needed to carry out a 2-sample
proprotion test.
I have the hypotesized treatment probability of success (0.80), the
hypotesized control probability of success (0.05), and also de proportion of
the sample devoted to treated group (5%), (fraction=rho=0.05, n2/n1=19).
Using the Hsmisc library, it seemss that I can use bsamsize (option 1) or
samplesize.bin (option 2, alpha=0.05 or option 3 alpha=0.05/2, I am not sure
after reading the help page) and I can use STATA (option 4).
library(Hmisc)
#OPTION 1:
bsamsize(p1=0.8, p2=0.05, fraction=0.05, alpha=.05, power=.9)
# n1 =2.09, n2=39.7, TOTAL=42
#OPTION 2:
samplesize.bin(alpha=0.05, beta=0.9, pit=0.8, pic=0.05, rho=0.05)
# n= 58, TOTAL= 58
#OPTION 3:
samplesize.bin(alpha=0.025, beta=0.9, pit=0.8, pic=0.05, rho=0.05)
# n= 72, TOTAL= 72
#OPTION 4:
sampsi 0.8 0.05, p(0.90) a(0.05) r(19)
# n1=4, n2 = 76 TOTAL=80
Can the method used produces the differences (42 vs 72 vs 80)? Can somebody
give me hints about the possible reasons (asymptotic-exact distribution-
continuity correction-my own error)? Which method would be recomended?
Thanks a lot in advance,
Berta
More information about the R-help
mailing list