Let’s work out another non-parametric hypothesis test – analogous to repeated measures ANOVA, the Friedman test. The way it works is exemplified by analysing ten runners who participated in a training program. The following are the measured heart rates at regular intervals. Your task is to inspect if there is a significant difference in the heart rate of patients across the three time points.
H_Rate <- matrix(c(150, 143, 142,
140, 143, 140,
160, 158, 165,
145, 140, 138,
138, 130, 128,
122, 120, 125,
132, 131, 128,
152, 155, 150,
145, 140, 140,
140, 137, 135),
nrow = 10,
byrow = TRUE,
dimnames = list(1:10, c("INITIAL", "ONE WEEK", "TWO WEEKS")))
INITIAL ONE WEEK TWO WEEKS
1 150 143 142
2 140 143 140
3 160 158 165
4 145 140 138
5 138 130 128
6 122 120 125
7 132 131 128
8 152 155 150
9 145 140 140
10 140 137 135
The null hypothesis, H0: HR1 = HR2 = HR3 (mean heart rates across the intervals are all equal)
The alternative hypothesis, HA: There is a difference (at least one) during the interval.
The following command can execute the Friedman test,
friedman.test(H_Rate)
Friedman rank sum test
data: H_Rate
Friedman chi-squared = 5.8421, df = 2, p-value = 0.05388
The p-value is 0.053, which is greater than the significance value of 0.05; the evidence is not sufficient to reject the null hypothesis.