使用statannotations,我如何通过stats_params来修改统计测试?



我试图执行单侧学生t-test_ind,需要修改stats_params,但我无法这样做。

下面是我使用的代码:
plotting_parameters = {
'data':        df1, 
'x':           R, 
'y':           TMD, 
'hue':         None, #R, 
'hue_order':   None, #[Eq, Po], 
'order':       [Eq, Po], 
'ci':          'sd', 
'errcolor':    'black', 
'capsize':     0.2, 
}
annotator_parameters = {
'loc':                  'outside', 
'test':                 't-test_ind', 
'text_format':          'star', 
'line_offset':          0.0, 
'line_height':          0.015, 
'stats_params':         {'alternative': 'greater'}
}
pairs                 = [((Eq, Po))]
# Barplot
f, ax = plt.subplots()
ax = sns.barplot(**plotting_parameters)
annotator = Annotator(ax, pairs, **plotting_parameters)
annotator.configure(**annotator_parameters)
annotator.apply_and_annotate()
ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel)
ax = sns.despine() # takes the lines off on the right and top of the graph

在字典annotator_parameters中,变量stats_params似乎没有传递给scipy.stats

我做错了什么吗?

当我过去使用statannot时,我会传递变量并能够使其工作。

提前感谢!

您需要将stats_params提供给apply_test方法,而不是configure方法。不幸的是,apply_and_annotate方法不接受参数,因此您必须分别调用apply_testannotate:

annotator.apply_test(alternative='greater')
annotator.annotate()

最新更新