anova.mixed: Power Analysis for Mixed-Effects Analysis of Variance...

power.f.mixed.anovaR Documentation

Power Analysis for Mixed-Effects Analysis of Variance (F-Test)

Description

Calculates power or sample size for mixed-effects ANOVA design with two factors (between and within). When there is only one group observed over time, this design is often referred to as repeated-measures ANOVA.

Formulas are validated using G*Power and tables in PASS documentation.

NOTE: The pwrss.f.rmanova() function is deprecated and will no longer be supported, but it will remain available as a wrapper for power.f.mixed.anova() during the transition period.

Usage

 power.f.mixed.anova(eta.squared, null.eta.squared = 0,
                    factor.levels = c(2, 2),
                    factor.type = c("between", "within"),
                    rho.within = 0.50, epsilon = 1,
                    n.total = NULL, power = NULL, alpha = 0.05,
                    effect = c("between", "within", "interaction"),
                    ceiling = TRUE, verbose = TRUE, pretty = FALSE)

Arguments

eta.squared

(partial) eta-squared for the alternative.

null.eta.squared

(partial) eta-squared for the null.

rho.within

Correlation between repeated measures. For example, for pretest/post-test designs, this is the correlation between pretest and post-test scores regardless of group membership. The default is 0.50. If eta.squared is already adjusted for this correlation specify 'rho.within = NA'.

factor.levels

vector; integer; length of two representing the number of levels for groups and measures. For example, in randomized controlled trials with two arms (treatment and control) where pre-test, post-test, and follow-up test are administered, this would be represented as c(2, 3).

factor.type

vector; character; length of two indicating the order of between-subject and within-subject factors. By default, the first value represents the between-subject factor and the second value represents the within-subject factor. This argument is rarely needed, except when unsure which element in 'factor.levels' represent between-subject or within-subject factors. Therefore, specify the 'factor.levels' accordingly.

epsilon

non-sphericity correction factor, default is 1 (means no violation of sphericity). Lower bound for this argument is epsilon = 1 / (factor.levels[2] - 1).

n.total

integer; total sample size.

power

statistical power, defined as the probability of correctly rejecting a false null hypothesis, denoted as 1 - \beta.

alpha

type 1 error rate, defined as the probability of incorrectly rejecting a true null hypothesis, denoted as \alpha.

effect

character; the effect of interest: "between", "within", or "interaction".

ceiling

logical; TRUE by default. If FALSE sample size in each group is NOT rounded up.

verbose

logical; TRUE by default. If FALSE no output is printed on the console.

pretty

logical; whether the output should show Unicode characters (if encoding allows for it). FALSE by default.

Value

parms

list of parameters used in calculation.

test

type of the statistical test (F-Test).

df1

numerator degrees of freedom.

df2

denominator degrees of freedom.

ncp

non-centrality parameter under alternative.

null.ncp

non-centrality parameter under null.

power

statistical power (1-\beta).

n.total

total sample size.

References

Bulus, M., & Polat, C. (2023). pwrss R paketi ile istatistiksel guc analizi [Statistical power analysis with pwrss R package]. Ahi Evran Universitesi Kirsehir Egitim Fakultesi Dergisi, 24(3), 2207-2328. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.29299/kefad.1209913")}

Examples


######################################################
# pretest-post-test design with treatment group only  #
######################################################

# a researcher is expecting a difference of Cohen's d = 0.30
# between post-test and pretest score translating into
# Eta-squared = 0.022

# adjust effect size for correlation with 'rho.within'
power.f.mixed.anova(eta.squared = 0.022,
                    factor.levels = c(1, 2), # 1 between 2 within
                    rho.within = 0.50,
                    effect = "within",
                    alpha = 0.05, power = 0.80)

# if effect size is already adjusted for correlation
# use 'rho.within = NA'
power.f.mixed.anova(eta.squared = 0.08255,
                    factor.levels = c(1, 2), # 1 between 2 within
                    rho.within = NA,
                    effect = "within",
                    alpha = 0.05, power = 0.80)

##########################################################
# post-test only design with treatment and control groups #
##########################################################

# a researcher is expecting a difference of Cohen's d = 0.50
# on the post-test score between treatment and control groups
# translating into Eta-squared = 0.059
power.f.mixed.anova(eta.squared = 0.059,
                    factor.levels = c(2, 1),  # 2 between 1 within
                    effect = "between",
                    alpha = 0.05, power = 0.80)


#############################################################
# pretest-post-test design with treatment and control groups #
#############################################################

# a researcher is expecting a difference of Cohen's d = 0.40
# on the post-test score between treatment and control groups
# after controlling for the pretest translating into
# partial Eta-squared = 0.038
power.f.mixed.anova(eta.squared = 0.038,
                    factor.levels = c(2, 2),  # 2 between 2 within
                    rho.within = 0.50,
                    effect = "between",
                    alpha = 0.05, power = 0.80)

# a researcher is expecting an interaction effect
# (between groups and time) of Eta-squared = 0.01
power.f.mixed.anova(eta.squared = 0.01,
                    factor.levels = c(2, 2),  # 2 between 2 within
                    rho.within = 0.50,
                    effect = "interaction",
                    alpha = 0.05, power = 0.80)

# a researcher is expecting an interaction effect
# (between groups and time) of Eta-squared = 0.01
power.f.mixed.anova(eta.squared = 0.01,
                    factor.levels = c(2, 2),  # 2 between 2 within
                    rho.within = 0.50,
                    effect = "within",
                    alpha = 0.05, power = 0.80)

pwrss documentation built on Sept. 16, 2025, 9:11 a.m.