I need to compute the sample size to test the equality of proportion. However, I keep getting different answers. alpha =0.10, beta = 0.80 or 0.2, Pa = 0.50 and Pb =0.75
This is the code we need to check our answers:
power.prop.test(power=0.8,p1=0.50,p2=0.75, sig.level = 0.1)
This is my code:
pA=0.50
pB=0.75
kappa=1
alpha=0.10
beta=0.20
(nB=(pA*(1-pA)/kappa+pB*(1-pB))((qnorm(1-alpha/2)+qnorm(1-beta))/(pA-pB))^2)
ceiling(nB) # 70
z=(pA-pB)/sqrt(pA(1-pA)/nB/kappa+pB*(1-pB)/nB)
(Power=pnorm(z-qnorm(1-alpha/2))+pnorm(-z-qnorm(1-alpha/2)))