This is a tidy wrapper around dunn.test::dunn.test()
. It performs Dunn's test, a non-parametric pairwise follow-up for a Kruskal-Wallis test.
Usage
dunn_test(
x,
groups,
data,
p.adjust.method = c("holm", "hochberg", "bonferroni", "bh", "by", "sidak", "hs",
"none"),
alpha = 0.05
)
Value
A tibble with columns:
contrast
: The compared groups.statistic
: Dunn's test statistic (z).adj.p.value
: Adjusted p-value based on the specifiedp.adjust.method
.
Examples
mtcars2 <- transform(mtcars, cyl = factor(cyl))
kruskal.test(mpg ~ gear, data = mtcars2)
#>
#> Kruskal-Wallis rank sum test
#>
#> data: mpg by gear
#> Kruskal-Wallis chi-squared = 14.323, df = 2, p-value = 0.0007758
#>
dunn_test(mpg, gear, data = mtcars2)
#> # A tibble: 3 × 3
#> contrast statistic adj.p.value
#> <chr> <dbl> <dbl>
#> 1 3 - 4 -3.76 0.000253
#> 2 3 - 5 -1.65 0.0998
#> 3 4 - 5 1.14 0.127