Learn R Programming

DMAR (version 1.0.0)

ss_power_split_plot_anova: Sample Size or Power for a Mixed-Effects ANOVA (Between X Within Design)

Description

Determine the necessary per-group sample size to achieve a desired level of statistical power for one of the three F tests in a mixed-effects ANOVA with one between-subjects factor and one within-subjects factor -- between-subjects main effect, within-subjects main effect, or the between x within interaction -- or, given a per-group sample size, return the realized statistical power. (This design is also commonly called a split-plot factorial.)

Usage

ss_power_split_plot_anova(
  a,
  b,
  effect,
  f = NULL,
  partial_eta_squared = NULL,
  rho,
  epsilon = 1,
  desired_power = 0.85,
  alpha_level = 0.05,
  n = NULL
)

Value

A data.frame with rows for necessary_n_per_group (or

specified_n_per_group), total_N, effect_df, error_df,

noncentrality, and actual_power. The result carries the

dmar_ss_power class, so tidy and

glance summarize it in broom convention (the reported size is the per-group count).

Arguments

a

Number of levels of the between-subjects factor (i.e., number of groups)

b

Number of levels of the within-subjects factor (i.e., number of measurement occasions)

effect

Which F test to compute power for: "between", "within", or "interaction"

f

Cohen's f effect size for the chosen effect (the population value); supply this or partial_eta_squared, but not both

partial_eta_squared

Partial eta squared for the chosen effect; supply this or f

rho

Average correlation among the repeated measures within a subject (must lie in (-1, 1)). Higher rho reduces power for the between-subjects test (because subject means contain more redundant information) and increases power for the within-subjects and interaction tests

epsilon

Greenhouse-Geisser / Huynh-Feldt sphericity adjustment in (0, 1] (default 1, sphericity assumed). Applied to the within-subjects and interaction tests but not the between-subjects test. Both numerator and denominator df, and the noncentrality, are multiplied by epsilon (Muller-Barton convention)

desired_power

Desired statistical power (default 0.85)

alpha_level

Type I error rate (default 0.05)

n

Per-group (between-subjects) sample size; if specified, returns the realized power

Author

Ken Kelley [email protected]

Details

This is a two-factor mixed-effects design: one between-subjects factor with \(a\) levels and one within-subjects factor with \(b\) levels; \(n\) subjects are randomly assigned to each between-subjects level and each subject is measured at all \(b\) within-subjects levels, for \(N = na\) subjects total and \(Nb\) observations. The covariance among the \(b\) within-subject observations is summarized by rho, the average pairwise correlation.

The three F tests have noncentrality parameters $$\lambda_{B} = N b f^2 / (1 + (b - 1) \rho)$$ for the between-subjects test (numerator df \(a - 1\), denominator df \(N - a\)), $$\lambda_{W} = N b f^2 \, \epsilon / (1 - \rho)$$ for the within-subjects test (numerator df \((b - 1)\epsilon\), denominator df \((N - a)(b - 1)\epsilon\)), and the same form as \(\lambda_W\) for the interaction (numerator df \((a - 1)(b - 1)\epsilon\), same denominator df). Cohen's f relates to partial eta squared via \(f = \sqrt{\eta_p^2 / (1 - \eta_p^2)}\).

This design is the compound-symmetry (random intercept) special case of the two-level linear mixed-effects model: rho is the intraclass correlation and the \(b\) occasions are the level-1 units of a subject. For two between-subjects groups the between-subjects F(1, .) test is therefore the two-level treatment t test of ss_power_mixed_effects squared, so the two planners agree on that shared case.

References

Maxwell, S. E., Delaney, H. D., & Kelley, K. (2027). Designing experiments and analyzing data: A model comparison perspective (4th ed.). Routledge.

Muller, K. E., & Barton, C. N. (1989). Approximate power for repeated measures ANOVA lacking sphericity. Journal of the American Statistical Association, 84, 549--555.

See Also

ss_power_one_way_anova, ss_power_factorial_anova, ss_power_rm_anova, ss_power_mixed_effects

design_consequences for what a chosen design delivers: power, the Type S (sign) and Type M (exaggeration) errors of the significance filter, and the expected confidence interval width.

Other sample size for power: power_fisher_exact(), ss_aipe_mixed_effects(), ss_power_R2(), ss_power_R2_sensitivity(), ss_power_c(), ss_power_c_ancova(), ss_power_composite_ancova(), ss_power_composite_ancova_2group(), ss_power_composite_anova(), ss_power_composite_factorial_ancova(), ss_power_composite_factorial_ancova_het(), ss_power_composite_factorial_anova(), ss_power_composite_sem(), ss_power_contrast(), ss_power_equivalence_c(), ss_power_factorial_ancova(), ss_power_factorial_anova(), ss_power_indirect_effect(), ss_power_mixed_effects(), ss_power_one_way_anova(), ss_power_pcm(), ss_power_r(), ss_power_rc(), ss_power_reg_coef(), ss_power_reg_coef_sensitivity(), ss_power_rm_anova(), ss_power_sc(), ss_power_sem(), ss_power_smd()

Other mixed models: R2_mixed_effects(), R2_mixed_effects_decomposition(), icc_lmer(), manova_split_plot(), mixed_anova(), ss_aipe_mixed_effects(), ss_aipe_mixed_effects_sensitivity(), ss_power_mixed_effects()

Examples

Run this code
# 2 groups, 4 occasions, between-subjects effect, f = 0.25,
# average within-subject correlation 0.5, power = .80
ss_power_split_plot_anova(a = 2, b = 4, effect = "between", f = 0.25,
                    rho = 0.5, desired_power = 0.80)

# Same design, within-subjects (occasion) main effect, f = 0.25
ss_power_split_plot_anova(a = 2, b = 4, effect = "within", f = 0.25,
                    rho = 0.5, desired_power = 0.80)

# Same design, between x within interaction, f = 0.25
ss_power_split_plot_anova(a = 2, b = 4, effect = "interaction", f = 0.25,
                    rho = 0.5, desired_power = 0.80)

# Realized power for n = 25 per group on the interaction test, partial eta^2 = 0.06
ss_power_split_plot_anova(a = 2, b = 4, effect = "interaction",
                    partial_eta_squared = 0.06, rho = 0.5, n = 25)

# Greenhouse-Geisser correction with epsilon = 0.7 on the within-subjects test
ss_power_split_plot_anova(a = 2, b = 4, effect = "within", f = 0.25,
                    rho = 0.5, epsilon = 0.7, desired_power = 0.80)

Run the code above in your browser using DataLab