anofaN2Power | R Documentation |
The function anofaN2Power()
performs an analysis of statistical power
according to the ANOFA
framework. See \insertCitelc23b;textualANOFA for more.
anofaPower2N()
computes the sample size to reach a given power.
anofaPower2N(power, P, f2, alpha)
anofaN2Power(N, P, f2, alpha)
N |
sample size; |
P |
number of groups; |
f2 |
effect size Cohen's $f^2$; |
alpha |
(default if omitted .05) the decision threshold. |
power |
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()
)
# 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)
# 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)
# 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)
# to find that a little more than 132 participants are enough.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.