From 4ce74e8ac5830928cbba0edadddae5adf928a4b2 Mon Sep 17 00:00:00 2001 From: vbrumovska Date: Mon, 16 Nov 2020 17:57:45 +0100 Subject: [PATCH] Add Anova --- statannot/statannot.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/statannot/statannot.py b/statannot/statannot.py index 05e3009..30af8b7 100644 --- a/statannot/statannot.py +++ b/statannot/statannot.py @@ -27,6 +27,9 @@ def stat_test( ): """Get formatted result of two sample statistical test. + EDIT 16.11.2020 - Veronika Brumovska + - implementing ANOVA (line 84) + Arguments --------- bbox_data1, bbox_data2 @@ -78,6 +81,17 @@ def stat_test( u_stat, pval, ) + elif test == 'anova': + u_stat, pval = stats.f_oneway( + box_data1, box_data2, **stats_params + ) + result = StatResult( + 'anova', + 'anova', + 'U_stat', + u_stat, + pval, + ) elif test == 'Mann-Whitney-gt': u_stat, pval = stats.mannwhitneyu( box_data1, box_data2, alternative='greater', **stats_params @@ -365,7 +379,7 @@ def get_box_data(box_plotter, boxName): "or `test_short_name` must be `None`.") valid_list = ['t-test_ind', 't-test_welch', 't-test_paired', 'Mann-Whitney', 'Mann-Whitney-gt', 'Mann-Whitney-ls', - 'Levene', 'Wilcoxon', 'Kruskal'] + 'Levene', 'Wilcoxon', 'Kruskal', "anova"] if test not in valid_list: raise ValueError("test value should be one of the following: {}." .format(', '.join(valid_list)))