Fix #19: Add Greenhouse-Geisser epsilon for interaction in rm_anova2#484
Fix #19: Add Greenhouse-Geisser epsilon for interaction in rm_anova2#484mariam851 wants to merge 3 commits intoraphaelvallat:mainfrom
Conversation
|
Hi @mariam851, Thank you for opening the issue and addressing this long-standing issue ! A few requests:
Thanks, |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #484 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 19 19
Lines 3362 3363 +1
Branches 493 493
=======================================
+ Hits 3313 3314 +1
Misses 26 26
Partials 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @raphaelvallat, I've updated the PR to fix the interaction epsilon in rm_anova2. The fix: I replaced the formulaic approach with a direct pivot_table(columns=[within_a, within_b]). This ensures the epsilon function receives the correct wide-format data, fixing the GG epsilon (now correctly returns 0.727 instead of 0.96/1.0). CI Failures Note: The current failures in test_corr, test_friedman, and test_ttest are unrelated to my changes. They exist in the master branch due to recent dependency updates (e.g., the AttributeError in SciPy). The code has been formatted with ruff and is ready for review. |
raphaelvallat
left a comment
There was a problem hiding this comment.
Thanks @mariam851 — I just left a few comments.
Could you please also rebase your branch to the latest main? Thanks
| # very conservative (same behavior as described on real-statistics.com). | ||
| eps_ab = epsilon(data_piv, correction="gg") | ||
|
|
||
| piv_ab_full = data.pivot_table(index=subject, columns=[a, b], values=dv, observed=True) |
There was a problem hiding this comment.
How is that different from the data_piv above?
data_piv = data.pivot_table(index=subject, columns=within, values=dv, observed=True)
data_piv = data_piv.dropna()| correction=True, | ||
| ).round(5) | ||
|
|
||
| assert aov.at[2, "eps"] == 0.72717 |
There was a problem hiding this comment.
See my above comment — I'm not sure I understand the difference between the previous and new behavior
| "seaborn", | ||
| "statsmodels", | ||
| "tabulate", | ||
| "formulaic", |
There was a problem hiding this comment.
Remove if we no longer use it
Hi @raphaelvallat,
Description
This PR addresses Issue #19 by implementing the Greenhouse-Geisser epsilon calculation for the interaction term in
rm_anova2. Previously, the interaction epsilon was not supported and often defaulted to 1.0 or caused issues in certain datasets.Changes
patsyto ensure consistency with JASP and R (ezANOVA).