# two-sided
# power defined as the probability of observing test statistics greater than
# the positive critical value OR less than the negative critical value
power.z.test(mean = 1.96, alpha = 0.05, alternative = "two.sided")
power.z.test(power = 0.80, alpha = 0.05, alternative = "two.sided")
# one-sided
# power is defined as the probability of observing a test statistic greater
# than the critical value
power.z.test(mean = 1.96, alpha = 0.05, alternative = "one.sided")
power.z.test(power = 0.80, alpha = 0.05, alternative = "one.sided")
# equivalence
# power is defined as the probability of observing a test statistic greater
# than the upper critical value (for the lower bound) AND less than the
# lower critical value (for the upper bound)
power.z.test(mean = 0, null.mean = c(-2, 2), alpha = 0.05,
alternative = "two.one.sided")
power.z.test(power = 0.80, req.sign = "0", null.mean = c(-2, 2),
alpha = 0.05, alternative = "two.one.sided")
# minimal effect testing
# power is defined as the probability of observing a test statistic greater
# than the upper critical value (for the upper bound) OR less than the lower
# critical value (for the lower bound).
power.z.test(mean = 2, null.mean = c(-1, 1), alpha = 0.05,
alternative = "two.one.sided")
power.z.test(power = 0.80, req.sign = "+", null.mean = c(-1, 1),
alpha = 0.05, alternative = "two.one.sided")
Run the code above in your browser using DataLab