Skip to contents

Determine the necessary total sample size to achieve a desired level of statistical power for the omnibus F test in a one-way between-subjects analysis of variance, or, given a total sample size, return the realized statistical power.

Usage

ss_power_one_way_anova(
  a,
  f = NULL,
  eta_squared = NULL,
  desired_power = 0.85,
  alpha_level = 0.05,
  N = NULL
)

Arguments

a

Number of groups (levels of the between-subjects factor)

f

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

eta_squared

Population eta squared (proportion of total variance accounted for by group membership); supply this or f

desired_power

Desired statistical power (default 0.85)

alpha_level

Type I error rate (default 0.05)

N

Total sample size; if specified, the function returns the realized power (the ss_power_* family is not uniform here: ss_power_contrast takes a per-group size)

Value

A data.frame. When a sample size is being planned (N not supplied) the rows are necessary_N, n_per_group, a, noncentrality, and actual_power; the search constructs the total as a balanced design, so n_per_group is a whole-number per-group count. When N is supplied, power is evaluated at that total N directly and the rows are specified_N, a, noncentrality, and actual_power (no n_per_group row, since balance is not assumed). The result carries the dmar_ss_power class, so tidy and glance summarize it in broom convention; the summarized sample size is the total N.

Details

Under the alternative hypothesis, the omnibus F statistic follows a noncentral F distribution with numerator df \(a - 1\), denominator df \(N - a\), and noncentrality parameter \(\lambda = N f^2\). Cohen's f relates to eta squared via \(f = \sqrt{\eta^2 / (1 - \eta^2)}\).

The function searches over total sample sizes \(N\) (treating per-group \(N/a\) as balanced) until power first reaches desired_power. When N is supplied it instead reports the realized power at that N.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale, NJ: Lawrence Erlbaum.

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

Author

Ken Kelley kkelley@nd.edu

Examples

# Three groups, f = 0.25, power = .80
ss_power_one_way_anova(a = 3, f = 0.25, desired_power = 0.80)
#>  term          value
#>  necessary_N   159  
#>  n_per_group   53   
#>  a             3    
#>  noncentrality 9.94 
#>  actual_power  0.805

# Same effect specified via eta squared
ss_power_one_way_anova(a = 3, eta_squared = 0.0588, desired_power = 0.80)
#>  term          value
#>  necessary_N   159  
#>  n_per_group   53   
#>  a             3    
#>  noncentrality 9.93 
#>  actual_power  0.805

# Realized power at N = 60 across 3 groups
ss_power_one_way_anova(a = 3, f = 0.25, N = 60)
#>  term          value
#>  specified_N   60   
#>  a             3    
#>  noncentrality 3.75 
#>  actual_power  0.374