Last active
October 16, 2022 15:46
-
-
Save trevismd/f556d83f6efdad249f995eb65daeb1d9 to your computer and use it in GitHub Desktop.
Create a `statannotations` v0.5+ `StatTest` with a permutations-stats test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import permutations_stats.permutations as pms | |
import seaborn as sns | |
from statannotations.statannotations import Annotator | |
from statannotations.stats.StatTest import StatTest | |
stat_test = StatTest(func=pms.permutation_test, | |
test="brunner_munzel", | |
test_long_name="Brunner Munzel exact test", | |
test_short_name="BM", | |
stat_name="Tn") | |
data = [[1, 2, 5, 8], [4, 6, 7, 9]] | |
box_pairs = [(0, 1)] | |
ax = sns.boxplot(data=data) | |
annotator = Annotator(ax=ax, data=data, pairs=box_pairs) | |
annotator.configure(comparisons_correction=None, text_format="simple", test=stat_test) | |
annotator.apply_and_annotate() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment