friedman_test.Rd
Provides a pipe-friendly framework to perform a Friedman rank sum
test, which is the non-parametric alternative to the one-way repeated
measures ANOVA test. Wrapper around the function
friedman.test()
.
friedman_test(data, formula, ...)
data | a data.frame containing the variables in the formula. |
---|---|
formula | a formula of the form |
... | other arguments to be passed to the function
|
return a data frame with the following columns:
.y.
: the y (dependent) variable used in the test.
n
: sample count.
statistic
: the value of Friedman's chi-squared statistic, used to
compute the p-value.
p
: p-value.
method
: the
statistical test used to compare groups.
# Load data #::::::::::::::::::::::::::::::::::::::: data("ToothGrowth") df <- ToothGrowth %>% filter(supp == "VC") %>% mutate(id = rep(1:10, 3)) head(df)#> len supp dose id #> 1 4.2 VC 0.5 1 #> 2 11.5 VC 0.5 2 #> 3 7.3 VC 0.5 3 #> 4 5.8 VC 0.5 4 #> 5 6.4 VC 0.5 5 #> 6 10.0 VC 0.5 6# Friedman rank sum test #::::::::::::::::::::::::::::::::::::::::: df %>% friedman_test(len ~ dose | id)#> # A tibble: 1 x 6 #> .y. n statistic df p method #> * <chr> <int> <dbl> <dbl> <dbl> <chr> #> 1 len 10 20 2 0.0000454 Friedman test