A function for computing power of two-sided tests
corresponding to z-scores for a given significance level.
alpha
(or corresponding cut-off z-score a
)
z_to_power(
z,
alpha = 0.05,
a = stats::qnorm(alpha/2, lower.tail = FALSE),
two.sided = TRUE
)
A vector of z-scores
Level of significance alpha
Or, alternatively a z-score corresponding to alpha
Whether directionality of the effect size should be taken into account.
# mean powers corresponding to the mean components of KD2
z_to_power(0:6, alpha = .05)
#> [1] 0.0500000 0.1700750 0.5160053 0.8508388 0.9793266 0.9988173 0.9999733