非参数检验适用于非正态数据
- 存在两个以上的组,譬如三组,检验总体上这些组是否存在显著差异,使用 Kruskal-Wallis 检验,可以得到多组之间是否存在差异(p<0.05)。该检验可以进一步计算差异的效应值E2
R包rstatix::kruskal_effsize 函数可以计算该值。
The eta-squared estimate(E2)assumes values from 0 to 1 and multiplied by 100 indicates the percentage of variance in the dependent variable explained by the independent variable. The interpretation values commonly in published litterature are: 0.01- < 0.06 (small effect), 0.06 - < 0.14 (moderate effect) and >= 0.14 (large effect).
- Kruskal-Wallis 检验 仅仅能够鉴定组间是否存在显著差异,想要进一步探究那些组之间存在显著差异,则需要进一步使用 Wilcoxon tests进行两两比较,见wilcox_test {rstatix}。 不多赘述。
3。 ggplot2 中可以为上述两种检验添加显著性标记等,
#### for Wilcoxon tests
ggsignif::geom_signif(comparisons = list(c("basal","q0.95.inter"),
c("basal","q0.95.top"),
c("q0.95.inter","q0.95.top")),# 设置需要比较的组
map_signif_level = T, #是否使用*显示
test = wilcox.test, ##计算方法
y_position = c(1.8,2,2.4),#图中横线位置设置
tip_length = c(c(0.05,0.05),
c(0.05,0.05),
c(0.05,0.05)),#横线下方的竖线设置
size=0.8,color="black")
#### for Kruskal-Wallis tests
ggpubr::stat_kruskal_test(label.x = 1, label.y = 2, hjust = 0)
REF:
Kruskal-Wallis Test in R: The Ultimate Guide - Datanovia
Add Kruskal-Wallis Test P-values to a GGPlot — stat_kruskal_test • ggpubr (datanovia.com)