# required sample size to detect a mean difference of
# Cohen's d = 0.50 for a one-way two-group design
power.f.ancova.keppel(mu.vector = c(0.50, 0), # marginal means
sd.vector = c(1, 1), # unadjusted standard deviations
n.vector = NULL, # sample size (will be calculated)
p.vector = c(0.50, 0.50), # balanced allocation
k.covariates = 1, # number of covariates
r.squared = 0.50, # explanatory power of covariates
alpha = 0.05, # Type 1 error rate
power = .80)
# effect size approach
power.f.ancova(eta.squared = 0.111, # effect size that is already adjusted for covariates
factor.levels = 2, # one-way ANCOVA with two levels (groups)
k.covariates = 1, # number of covariates
alpha = 0.05, # Type 1 error rate
power = .80)
# regression approach
p <- 0.50
power.t.regression(beta = 0.50,
sd.predictor = sqrt(p * (1 - p)),
sd.outcome = 1,
k.total = 1,
r.squared = 0.50,
n = NULL, power = 0.80)
Run the code above in your browser using DataLab