A power analysis for a one sample z-test. The function requires \(\alpha\), \(\sigma\), the effect size, the type of test (one tailed or two-tailed), and either power (1 - \(\beta\)) or n (sample size). If n is provided, then power is calculated. Conversely, if one provides power, but not n, then the required n is calculated.
power.z.test(sigma = 1, n = NULL, power = NULL, alpha = 0.05, effect = NULL,
test = c("two.tail", "one.tail"), strict = FALSE)
Returns a list
The prescribed population variance.
The sample size.
The power.
The type I error probability.
The type of test prescribed.
The effect size.
The population standard deviation.
The sample size. Not required if power
is specified.
The desired power. Not required if n
is specified.
Probability of type I error.
Effect size.
One of two choices: "two.tail"
or "one.tail"
.
Causes the function to use a strict interpretation of power in a two-sided test.
If strict = TRUE
then power for a two sided test will include the probability of rejection
in the opposite tail of the true effect. If strict = FALSE
(the default) power will be half the value of \(\alpha\) if the true effect size is zero.
Ken Aho
Bain, L. J., and M. Engelhardt (1992) Introduction to Probability and Mathematical Statistics. Duxbury press. Belmont, CA, USA.
power.z.test(sigma=6,effect=5,power=.9,test="one.tail")
Run the code above in your browser using DataLab