I was trying to rework the examples in Epidemiology Study Design and Data Analysis by Mark Woodward using R. Example 8.12 deals with calculation of sample size to test for a population proportion of 0.3 against the one sided alternative that it is greater than 0.32.
I tried two commands
power.prop.test(n = NULL, p1=0.3, p2=0.32, power =0.9, alternative = "one.sided")
epiR::epi.sscompb(n = NA, treat = 0.3, control = 0.32, power = 0.9, sided.test = 1 )
The results (sample size) given by the two functions are very different.
Two-sample comparison of proportions power calculation
n = 9157.159
p1 = 0.3
p2 = 0.32
sig.level = 0.05
power = 0.9
alternative = one.sided
NOTE: n is number in *each* group
$n.total
[1] 4568
$n.treat
[1] 2284
$n.control
[1] 2284
$power
[1] 0.9
$lambda
[1] 0.937500 1.066667
The result by epi.sscompb agrees with the value in the book.
Can someone tell me if there is an error in the code? If there is no error in the code, why are the results different?
Thanks, ajith