# 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.t.test(ncp = 1.96, df = 100, alpha = 0.05, alternative = "two.sided")
power.t.test(power = 0.80, df = 100, 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.t.test(ncp = 1.96, df = 100, alpha = 0.05, alternative = "one.sided")
power.t.test(power = 0.80, df = 100, 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.t.test(ncp = 0, null.ncp = c(-2, 2), df = 100, alpha = 0.05,
alternative = "two.one.sided")
power.t.test(power = 0.80, req.sign = "0", null.ncp = c(-2, 2),
df = 100, 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.t.test(ncp = 2, null.ncp = c(-1, 1), df = 100, alpha = 0.05,
alternative = "two.one.sided")
power.t.test(power = 0.80, req.sign = "+", null.ncp = c(-1, 1),
df = 100, alpha = 0.05, alternative = "two.one.sided")
Run the code above in your browser using DataLab