# Calculating Power Z*score

I am trying to present sample size determination based on determining a certain difference between two proportions and the power of the test. As I understand it, my calculation requires both z-alpha and z-beta. From past experience I am aware that z-beta for a power of 90% is 1.282 and z-beta for a power of 80% is 0.842.

However, I am not sure what z-beta is for a power of 70%. I would love to use this for my study as well and also would am curious as to if anyone can provide a table for these values or a way to find this in R. Thanks!

$z_\alpha$ and $z_\beta$ simply refer to the $\alpha$ and $\beta$ quantiles of the $N(0,1)$ distribution. What you are looking for is the qnorm() function:

qnorm(0.9)
[1] 1.281552

qnorm(0.8)
[1] 0.8416212


Therefore, quite simply:

qnorm(0.7)
[1] 0.5244005


Following this webpage's framework, an R function that calculates the required sample size given $p_A$ , $p_B$, $\alpha$, $\beta$ and $\kappa$ could be:

sample.size.diff.prop <- function(pA, pB, kappa, alpha, beta) {
nB <- (pA*(1-pA)/kappa+pB*(1-pB))*((qnorm(1-alpha/2)+qnorm(1-beta))/(pA-pB))^2
nA <- kappa*ceiling(nB)
cat("The required sample size is", ceiling(nA), "in group A and", ceiling(nB), "in group B.")}


Please note that the "beta" parameter is $1 - \textit{desired power}$. This little code snippet demonstrates the output generated by this function:

sample.size.diff.prop(pA = 0.65, pB = 0.85, kappa = 2, alpha = 0.05, beta = 0.2)
The required sample size is 96 in group A and 48 in group B.