pingouin.power_anova(eta=None, k=None, n=None, power=None, alpha=0.05)[source]

Evaluate power, sample size, effect size or significance level of a one-way balanced ANOVA.


ANOVA effect size (eta-square == \(\eta^2\)).


Number of groups


Sample size per group. Groups are assumed to be balanced (i.e. same sample size).


Test power (= 1 - type II error).


Significance level (type I error probability). The default is 0.05.


Exactly ONE of the parameters eta, k, n, power and alpha must be passed as None, and that parameter is determined from the others.

Notice that alpha has a default value of 0.05 so None must be explicitly passed if you want to compute it.

This function is a mere Python translation of the original pwr.anova.test function implemented in the pwr package. All credit goes to the author, Stephane Champely.

Statistical power is the likelihood that a study will detect an effect when there is an effect there to be detected. A high statistical power means that there is a low probability of concluding that there is no effect when there is one. Statistical power is mainly affected by the effect size and the sample size.

For one-way ANOVA, eta-square is the same as partial eta-square. It can be evaluated from the f-value and degrees of freedom of the ANOVA using the following formula:

\[\eta^2 = \frac{v_1 F^*}{v_1 F^* + v_2}\]

Using \(\eta^2\) and the total sample size \(N\), the non-centrality parameter is defined by:

\[\delta = N * \frac{\eta^2}{1 - \eta^2}\]

Then the critical value of the non-central F-distribution is computed using the percentile point function of the F-distribution with:

\[q = 1 - alpha\]
\[v_1 = k - 1\]
\[v_2 = N - k\]

where \(k\) is the number of groups.

Finally, the power of the ANOVA is calculated using the survival function of the non-central F-distribution using the previously computed critical value, non-centrality parameter, and degrees of freedom.

scipy.optimize.brenth() is used to solve power equations for other variables (i.e. sample size, effect size, or significance level). If the solving fails, a nan value is returned.

Results have been tested against GPower and the R pwr package.



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



  1. Compute achieved power

>>> from pingouin import power_anova
>>> print('power: %.4f' % power_anova(eta=0.1, k=3, n=20))
power: 0.6082
  1. Compute required number of groups

>>> print('k: %.4f' % power_anova(eta=0.1, n=20, power=0.80))
k: 6.0944
  1. Compute required sample size

>>> print('n: %.4f' % power_anova(eta=0.1, k=3, power=0.80))
n: 29.9255
  1. Compute achieved effect size

>>> print('eta: %.4f' % power_anova(n=20, k=4, power=0.80, alpha=0.05))
eta: 0.1255
  1. Compute achieved alpha (significance)

>>> print('alpha: %.4f' % power_anova(eta=0.1, n=20, k=4, power=0.80,
...                                   alpha=None))
alpha: 0.1085