The function anofaN2Power()
performs an analysis of statistical power
according to the ANOFA
framework. See Laurencelle and Cousineau (2023)
for more.
anofaPower2N()
computes the sample size to reach a given power.
anofaPower2N(power, P, f2, alpha)
anofaN2Power(N, P, f2, alpha)
sample size;
number of groups;
effect size Cohen's $f^2$;
(default if omitted .05) the decision threshold.
target power to attain;
a model fit to the given frequencies. The model must always be an omnibus model
(for decomposition of the main model, follow the analysis with emfrequencies()
or contrasts()
)
Laurencelle L, Cousineau D (2023). “Analysis of frequency tables: The ANOFA framework.” The Quantitative Methods for Psychology, 19, 173--193. doi:10.20982/tqmp.19.2.p173 .
# 1- The Landis et al. study had tremendous power with 533 participants in 15 cells:
# where 0.2671 is the observed effect size for the interaction.
anofaN2Power(533, 5*3, 0.2671)
#> [1] 1
# power is 100% because sample is large and effect size is as well.
# Even with a quarter of the participants, power is overwhelming:
# because the effect size is quite large.
anofaN2Power(533/4, 5*3, 0.2671)
#> [1] 0.9895581
# 2- Power planning.
# Suppose we plan a four-classification design with expected frequencies of:
pred <- c(.35, .25, .25, .15)
# P is the number of classes (here 4)
P <- length(pred)
# We compute the predicted f2 as per Eq. 5
f2 <- 2 * sum(pred * log(P * pred) )
# the result, 0.0822, is a moderate effect size.
# Finally, aiming for a power of 80%, we run
anofaPower2N(0.80, P, f2)
#> [1] 132.501
# to find that a little more than 132 participants are enough.