statsmodels.stats.power.FTestPower.power

FTestPower.power(effect_size, df_num, df_denom, alpha, ncc=1)[source]

Calculate the power of a F-test.

The effect size is Cohen’s f, square root of f2.

The sample size is given by nobs = df_denom + df_num + ncc

Warning: The meaning of df_num and df_denom is reversed.

Parameters:
effect_sizefloat

Standardized effect size. The effect size is here Cohen’s f, square root of f2.

df_numint or float

Warning incorrect name denominator degrees of freedom, This corresponds to the number of constraints in Wald tests.

df_denomint or float

Warning incorrect name numerator degrees of freedom. This corresponds to the df_resid in Wald tests.

alphafloat in interval (0,1)

significance level, e.g. 0.05, is the probability of a type I error, that is wrong rejections if the Null Hypothesis is true.

nccint

degrees of freedom correction for non-centrality parameter. see Notes

Returns:
powerfloat

Power of the test, e.g. 0.8, is one minus the probability of a type II error. Power is the probability that the test correctly rejects the Null Hypothesis if the Alternative Hypothesis is true.

Notes

sample size is given implicitly by df_num

set ncc=0 to match t-test, or f-test in LikelihoodModelResults. ncc=1 matches the non-centrality parameter in R::pwr::pwr.f2.test

ftest_power with ncc=0 should also be correct for f_test in regression models, with df_num and d_denom as defined there. (not verified yet)


Last update: Nov 14, 2024