参考
- https://github.com/trevismd/statannotations/blob/master/usage/example.ipynb
- https://github.com/trevismd/statannotations/tree/master
|
|
1. Basic use
|
|
Tips: sns.plot的data, x, y, order等绘图参数需要与Annotator的保持一致。

|
|
2. Annotator pairs参数设置
-
简单的两两比较:对应sns plot的x轴,e.g.
[("A", "B"), ("A", "C")]
, -
两个分组列情况:主分组对应sns plot的x轴,子分组对应hue列 e.g.
[(("A", "x"), ("A", "y")), (("B", "x"), ("B", "y"))]
|
|
3. Configure 检验以及校正方法
1) configure test
param can be
- t-test_ind 两组独立样本,正态分布
- t-test_paired 两组配对样本,正态分布
- Mann-Whitney 两组独立样本,非正态分布
- Mann-Whitney-gt 前组是否显著大于后组
- Mann-Whitney-ls 前组是否显著小于后组
- Wilcoxon 两组配对样本,非正态分布
- Kruskal 方差分析
2) configure comparisons_correction
param can be
- ‘bonferroni’, ‘bonf’, ‘Bonferroni’,
- ‘holm-bonferroni’, ‘HB’, ‘Holm-Bonferroni’, ‘holm’
- ‘benjamini-hochberg’, ‘BH’, ‘fdr_bh’, ‘Benjamini-Hochberg’
- ‘fdr_by’, ‘Benjamini-Yekutieli’, ‘BY’
|
|

3) 关于配对检验的数据:需要使得每个分组的配对样本的顺序保持一致
|
|

4. 显著性显示格式
1) configure text_format
param can be
- “star”: 显示为星号
- “simple”: e.g. p≤0.05 [可进一步设置 show_test_name=True/False]
- “full”: e.g. p=0.02 [同上]
2) configure pvalue_format
param
- 当 text_format = “star"时, 默认为
|
|
- 当 text_format = “simple"时, 默认为-
|
|
3) set_custom_annotations() 自定义标注的文本内容,而不作检验
|
|

5. 自定义检验方式
|
|

最后还可以调整标线line等元素的外观展示,效果。具体示例可以参考开头引用的example.ipynb