#############################################
# one-way ANOVA #
#############################################
# a researcher is expecting a difference of
# Cohen's d = 0.50 between treatment and control
# translating into Eta-squared = 0.059
# estimate sample size using ANOVA approach
pwrss.f.ancova(eta2 = 0.059, n.levels = 2,
alpha = 0.05, power = .80)
# estimate sample size using regression approach(F test)
pwrss.f.reg(r2 = 0.059, k = 1,
alpha = 0.05, power = 0.80)
# estimate sample size using regression approach (t test)
p <- 0.50 # proportion of sample in treatment
pwrss.t.reg(beta1 = 0.50, r2 = 0,
k = 1, sdx = sqrt(p*(1-p)),
alpha = 0.05, power = 0.80)
# estimate sample size using t test approach
pwrss.t.2means(mu1 = 0.50,
alpha = 0.05, power = 0.80)
#############################################
# two-way ANOVA #
#############################################
# a researcher is expecting a partial Eta-squared = 0.03
# for interaction of treatment (Factor A) with
# gender consisting of two levels (Factor B)
pwrss.f.ancova(eta2 = 0.03, n.levels = c(2,2),
alpha = 0.05, power = 0.80)
# estimate sample size using regression approach (F test)
# one dummy for treatment, one dummy for gender, and their interaction (k = 3)
# partial Eta-squared is equivalent to the increase in R-squared by adding
# only the interaction term (m = 1)
pwrss.f.reg(r2 = 0.03, k = 3, m = 1,
alpha = 0.05, power = 0.80)
#############################################
# one-way ANCOVA #
#############################################
# a researcher is expecting an adjusted difference of
# Cohen's d = 0.45 between treatment and control after
# controllling for the pretest (n.cov = 1)
# translating into Eta-squared = 0.048
pwrss.f.ancova(eta2 = 0.048, n.levels = 2, n.cov = 1,
alpha = 0.05, power = .80)
#############################################
# two-way ANCOVA #
#############################################
# a researcher is expecting an adjusted partial Eta-squared = 0.02
# for interaction of treatment (Factor A) with
# gender consisting of two levels (Factor B)
pwrss.f.ancova(eta2 = 0.02, n.levels = c(2,2), n.cov = 1,
alpha = 0.05, power = .80)
Run the code above in your browser using DataLab