You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG/REF/SUMM: problem I mix up df_num and df_denom very often #8651
so far it looks like in statsmodels.stats it's only the F power functions that have it reversed
in oneway: anova_oneway has it reversed in the docstring returns, but not in the code df = (df_denom, df_num) : tuple of floatsanova_generic returns HolderTuple with attributedf=(df_num, df_denom)`
in power:
helper function ftest_anova_power uses reversed arg sequence
ftest_anova_power has no bug, incorrect naming is only inside function, args are in terms of nobs and k_groups
however ftest_power and the corresponding FTestPower methods have the "naming bug" with df_num, df_denom as keywords in signature
The ftest_power function uses only positional args, so we can change it without backwards compat problems. Except for users that use keywords for positional. I switch to using df1, df2, so using df_num or df_denom as keyword will raise an exception.
Not really, problem is that the backwards compatible arg sequence would be df2, df1.
Fixed by PR #8648, which renamed the internal args (df2, df1) and added a corrected FTestPowerF2 class. The legacy FTestPower intentionally retains the reversed df_num/df_denom naming for backward compatibility, now clearly documented as such. Closing as fixed.
Activity
josef-pkt commentedon Feb 4, 2023
so far it looks like in statsmodels.stats it's only the F power functions that have it reversed
in oneway:
anova_oneway has it reversed in the docstring returns, but not in the codedf = (df_denom, df_num) : tuple of floatsanova_generic returns HolderTuple with attributedf=(df_num, df_denom)`in power:
helper function
ftest_anova_poweruses reversed arg sequenceand same in
ftest_powerfunctionftest_anova_powerhas no bug, incorrect naming is only inside function, args are in terms of nobs and k_groupshowever
ftest_powerand the correspondingFTestPowermethods have the "naming bug" with df_num, df_denom as keywords in signatureThe
ftest_powerfunction uses only positional args, so we can change it without backwards compat problems. Except for users that use keywords for positional. I switch to using df1, df2, so using df_num or df_denom as keyword will raise an exception.Not really, problem is that the backwards compatible arg sequence would be
df2, df1.bashtage commentedon Jul 30, 2026
Fixed by PR #8648, which renamed the internal args (df2, df1) and added a corrected FTestPowerF2 class. The legacy FTestPower intentionally retains the reversed df_num/df_denom naming for backward compatibility, now clearly documented as such. Closing as fixed.