I would like to perform a power analysis for the interaction effect in a 2 by 2 within-within ANOVA design. I would like to crosscheck that I am performing this correctly using the pwr::pwr.f2.test() function in R.

Required inputs

The pwr::pwr.f2.test() function requires the following parameters:

  • u: degrees of freedom for numerator

  • v: degrees of freedom for denominator

  • f2: the effect size Cohen's $f^2$

  • sig.level: $\alpha$ level

  • power: the desired power ($1 - \beta$)

We will omit v so the function will estimate this value.

Inputs for a $2 \times 2$ within-within design

  1. u

The numerator degrees of freedom for an interaction effect in this design is given as:

$$u = A \times B = (a - 1)(b - 1)$$

Where $a$ is the number of levels of Factor $A$, and $b$ is the number of levels of Factor $B$. Therefore, u is:

$$u = (2-1) \times (2-1) = 1$$

  1. f2

Let's assume I have estimated that the interaction effect should be $\eta^2_p$ = 0.2. I can convert this to $f^2$ using the following formula:

$$f^2 = \frac{\eta^2_p}{1 - \eta^2_p}$$

Therefore, f2 is:

$$f^2 = \frac{0.2}{1-0.2} = 0.25$$

  1. sig.level

I will set $\alpha = .05$

  1. power

I will set $power = 0.80$

Perform the analysis

We use the above inputs in the following power analysis:

pwr::pwr.f2.test(u = 1, f2 = 0.25, sig.level = 0.05, power = 0.8)

 Multiple regression power calculation 

          u = 1
          v = 31.42944
         f2 = 0.25
  sig.level = 0.05
      power = 0.8

The required denominator degrees of freedom to detect our effect with 80% power is 31.42. To convert v to the total $N$ required we will do some simple algebra.

The denominator degrees of freedom for a $2 \times 2$ interaction effect is given as:

$$v = A \times B \times S = (a - 1)(b - 1)(N - 1)$$

Where $N$ is the total sample size. In our study this is:

$$v = (2 - 1)(2 - 1)(N - 1) = N - 1$$

$$N = v + 1$$

This means we simply add 1 to v to estimate the required sample size, and round up:

ceiling(31.42944 + 1)
[1] 33

The required sample size is therefore $N = 33$.


Have I performed these steps correctly?


1 Answer 1


I think that all of the ANOVA functions in pwr are 1-way. If you have the right data, you should be able to do your calculation using Superpower. It's available as an R package and a shiny app (which is a bit like G*Power).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.