Friedman Rank Sum Test
Performs a Friedman rank sum test with unreplicated blocked data.
friedman.test can be used for analyzing unreplicated complete block designs (i.e., there is exactly one observation in y for each combination of levels of groups and blocks) where the normality assumption may be violated.
The null hypothesis is that apart from an effect of blocks, the location parameter of y is the same in each of the groups.
warpbreaks
- The number of Breaks in Yarn during Weaving
- This data set gives the number of warp breaks per loom, where a loom corresponds to a fixed length of yarn.
A data frame with 54 observations on 3 variables.
- breaks (numeric) The number of breaks
- wool (factor) The type of wool (A or B)
- tension (factor) The level of tension (L, M, H)
There are measurements on 9 looms for each of the six types of warp (AL, AM, AH, BL, BM, BH).
head(warpbreaks)
## breaks wool tension
## 1 26 A L
## 2 30 A L
## 3 54 A L
## 4 25 A L
## 5 70 A L
## 6 52 A L
wb <- aggregate(warpbreaks$breaks,
by = list(w = warpbreaks$wool,
t = warpbreaks$tension),
FUN = mean)
wb
## w t x
## 1 A L 44.55556
## 2 B L 28.22222
## 3 A M 24.00000
## 4 B M 28.77778
## 5 A H 24.55556
## 6 B H 18.77778
Formulations
friedman.test(wb$x, wb$w, wb$t)
##
## Friedman rank sum test
##
## data: wb$x, wb$w and wb$t
## Friedman chi-squared = 0.33333, df = 1, p-value = 0.5637
Alternative Formulations
friedman.test(x ~ w | t, data = wb)
##
## Friedman rank sum test
##
## data: x and w and t
## Friedman chi-squared = 0.33333, df = 1, p-value = 0.5637