14.6 Friedman ANOVAs
14.6.1 Introduction
The Friedman ANOVA (or Friedman test) is the non-parametric equivalent of a one-way repeated measures ANOVA. The idea behind the Friedman’s ANOVA is the same as its parametric counterpart, namely to test whether there are differences in treatments across multiple time points.
14.6.2 Example scenario
We will take a look at the autism dataset again, albeit with a new version called autism_wide.csv. In this scenario, we now want to see how expressive language changes over time. Note that the variables relating to age are referenced/centered to 2 years old. That is, a value of age2 of 0 indicates the child is 2 years old; a value of 1 refers to 3 years old and a value of 3 refers to 5 years old.
## Rows: 63 Columns: 9
## ── Column specification ────────────────────────
## Delimiter: ","
## chr (4): sicdegp, gender, race, bestest2
## dbl (5): childid, age_0, age_1, age_3, age_7
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
14.6.3 Checking assumptions (normal ANOVA)
Like last time, let’s examine our assumptions using a normal repeated-measures ANOVA. We can see that our sphericity assumption is violated (p < .001), and very severely so; recall that the W statistic in Mauchly’s test is a deviation from 1, so our test statistic of W = .047 is very low! This might be one instance where we would legitimately consider running a Friedman ANOVA, if we weren’t keen on applying such a strong Greenhouse-Geisser correction to our ANOVA.
## ANOVA Table (type III tests)
##
## $ANOVA
## Effect DFn DFd F p p<.05 ges
## 1 age2 3 186 48.401 3.62e-23 * 0.286
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 1 age2 0.047 4.88e-38 *
##
## $`Sphericity Corrections`
## Effect GGe DF[GG] p[GG] p[GG]<.05 HFe DF[HF] p[HF]
## 1 age2 0.434 1.3, 80.71 2.02e-11 * 0.439 1.32, 81.73 1.55e-11
## p[HF]<.05
## 1 *
14.6.4 Running a Friedman ANOVA
Friedman ANOVAs are available in R with the friedman.test() function. This function requires long data, and by and large even uses the same formula notation that we are used to. The only difference is that because this is repeated measures data, we must tweak the formula slightly to account for this. The formula needs to take outcome ~ predictor | id notation, where id needs to point to a column in the dataset that simply indicates each participant’s unique ID. Otherwise, the formula is much as you would expect:
##
## Friedman rank sum test
##
## data: vsae and age2 and childid
## Friedman chi-squared = 133.51, df = 3, p-value < 2.2e-16
Also like the Kruskal-Wallis ANOVA, R will report a chi-square as the test statistic. This is for the same reason as before; the actual test statistic Q approximates a chi-square distribution with large enough samples (e.g. n > 15). We can see that our omnibus result is significant (\(\chi^2\)(3) = 133.51, p < .001).
Although Jamovi does not give an effect size for a Friedman ANOVA, there actually is one called Kendall’s W. The effectsize package provides a function called - you guessed it - kendalls_w() to calculate this. The notation is the same as friedman.test().
## Warning: 9 block(s) contain ties.
Of course, we still need to do post-hoc pairwise comparisons. The post-hocs that Jamovi provides are called Durbin-Conover pairwise comparisons, which are simply called Durbin tests elsewhere. The PMCMRplus package we mentioned earlier provides a function called durbinAllPairsTest() to conduct these posthocs. Note that although the function can be run without assigning the output to a new object, this will only give p-values; to get the proper output, we will want to assign the function’s output to a variable and then run summary() on this.
This function will also allow you to use p-value adjustment methods. Holm adjusted p values are the default, which we will run with.
autism_posthoc <- PMCMRplus::durbinAllPairsTest(y = autism$vsae, groups = autism$age2, blocks = autism$childid)
summary(autism_posthoc)##
## Pairwise comparisons using Durbin's all-pairs test for a two-way balanced incomplete block design
## data: autism$vsae, autism$age2 and autism$childid
## P value adjustment method: holm
## H0
## t value Pr(>|t|)
## 1 - 0 == 0 7.317 2.2075e-11 ***
## 3 - 0 == 0 14.189 < 2.22e-16 ***
## 7 - 0 == 0 19.979 < 2.22e-16 ***
## 3 - 1 == 0 6.872 1.8542e-10 ***
## 7 - 1 == 0 12.662 < 2.22e-16 ***
## 7 - 3 == 0 5.790 2.9470e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The left column of this output is denoting a specific hypothesis being tested. For example, “1 - 0 == 0” means that it is testing whether the difference between age2 = 1 and age2 = 0 is equal to 0. The corresponding columns to the right give the test statistic and the p-value.
Based on our results, we can see that all comparisons are significant (p < .001). To interpret this, the most useful way would be to draw a plot and go back to the main descriptives, to infer that there is a significant increase or decrease in expressive language with age.