# Four-group example from Maxwell & Delaney's textbook tradition: contrast
# the average of three treatment means with a fourth (control), under
# population means (90, 92, 88, 81), within-group variance 144.
#
# 1. Power achieved at n = 20 per group (total N = 80). Should be ~ .80.
ss_power_contrast(
c_weights = c(1/3, 1/3, 1/3, -1),
mu = c(90, 92, 88, 81),
sigma_squared = 144,
n_per_group = 20
)
# 2. Per-group sample size needed for power = .90.
ss_power_contrast(
c_weights = c(1/3, 1/3, 1/3, -1),
mu = c(90, 92, 88, 81),
sigma_squared = 144,
desired_power = 0.90
)
# 3. Same effect size specification using a directly given psi.
ss_power_contrast(
c_weights = c(1/3, 1/3, 1/3, -1),
psi = 9,
sigma_squared = 144,
n_per_group = 20
)
# 4. Unequal per-group sample sizes.
ss_power_contrast(
c_weights = c(0.5, 0.5, -0.5, -0.5),
mu = c(90, 92, 88, 81),
sigma_squared = 144,
n_per_group = c(15, 25, 25, 15)
)
Run the code above in your browser using DataLab