#############################################
# one-way ANOVA #
#############################################
# Cohen's d = 0.50 between treatment and control
# translating into eta-squared = 0.059
# estimate sample size using ANOVA approach
power.f.ancova(eta.squared = 0.059,
factor.levels = 2,
power = .80, alpha = 0.05)
# estimate sample size using regression approach(F-Test)
power.f.regression(r.squared = 0.059,
k.total = 1,
power = 0.80, alpha = 0.05)
# estimate sample size using regression approach (t-Test)
p <- 0.50 # proportion of sample in treatment (allocation rate)
power.t.regression(beta = 0.50, r.squared = 0,
k.total = 1,
sd.predictor = sqrt(p * (1 - p)),
power = 0.80, alpha = 0.05)
# estimate sample size using t test approach
power.t.student(d = 0.50, power = 0.80, alpha = 0.05)
#############################################
# 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)
power.f.ancova(eta.squared = 0.03,
factor.levels = c(2,2),
power = 0.80, alpha = 0.05)
# 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)
power.f.regression(r.squared = 0.03,
k.total = 3, k.test = 1,
power = 0.80, alpha = 0.05)
#############################################
# 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 (k.covariates = 1)
# translating into eta-squared = 0.048
power.f.ancova(eta.squared = 0.048,
factor.levels = 2,
k.covariates = 1,
power = .80, alpha = 0.05)
#############################################
# 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)
power.f.ancova(eta.squared = 0.02,
factor.levels = c(2,2),
k.covariates = 1,
power = .80, alpha = 0.05)
Run the code above in your browser using DataLab