ART - non-parametric factorial ANOVA
Errors almost always do not conform to the assumptions of ANOVA anova-assumptions, so they are not easy to analyse in parametric procedures.
We can use the Aligned Rank Transform (ART) procedure. It operates on ranks like other non-parametric tests. In particular, it operates on aligned ranks: the data is aligned before it is ranked.
Aligned means that only the effect of interest is left in the data because we subtract out values from it that remove the possibility of other effects. E.g. if we are only interested in the effect of keyboard differences in WPM, we can align the data by subtracting the estimated effect of postures on WPM.
ART uses a Linear Mixed Model in the background
1## Nonparametric approach to factorial ANOVA
2## The Aligned Rank Transform (ART) procedure
3## http://depts.washington.edu/acelab/proj/art/
4
5library(plyr)
6ddply(mbltxt, ~ Keyboard * Posture, function(data) summary(data$Error_Rate))
7ddply(mbltxt, ~ Keyboard * Posture, summarise, Error_Rate.mean=mean(Error_Rate), Error_Rate.sd=sd(Error_Rate))
8
9hist(mbltxt[mbltxt$Keyboard == "iPhone" & mbltxt$Posture == "Sit",]$Error_Rate)
10hist(mbltxt[mbltxt$Keyboard == "iPhone" & mbltxt$Posture == "Stand",]$Error_Rate)
11hist(mbltxt[mbltxt$Keyboard == "iPhone" & mbltxt$Posture == "Walk",]$Error_Rate)
12hist(mbltxt[mbltxt$Keyboard == "Galaxy" & mbltxt$Posture == "Sit",]$Error_Rate)
13hist(mbltxt[mbltxt$Keyboard == "Galaxy" & mbltxt$Posture == "Stand",]$Error_Rate)
14hist(mbltxt[mbltxt$Keyboard == "Galaxy" & mbltxt$Posture == "Walk",]$Error_Rate)
15boxplot(Error_Rate ~ Keyboard * Posture, data=mbltxt, xlab="Keyboard.Posture", ylab="Error_Rate") # boxplots
16with(mbltxt, interaction.plot(Posture, Keyboard, Error_Rate, ylim=c(0, max(mbltxt$Error_Rate)))) # interaction?
17
18library(ARTool) # for art, artlm
19m = art(Error_Rate ~ Keyboard * Posture + (1|Subject), data=mbltxt) # uses LMM
20anova(m) # report anova
21shapiro.test(residuals(m)) # normality?
22qqnorm(residuals(m)); qqline(residuals(m)) # seems to conform
23
24with(mbltxt, interaction.plot(Posture, Keyboard, Error_Rate, ylim=c(0, max(mbltxt$Error_Rate)))) # for convenience
25library(emmeans) # for emmeans
26emmeans(artlm(m, "Keyboard"), pairwise ~ Keyboard)
27emmeans(artlm(m, "Posture"), pairwise ~ Posture)
28#emmeans(artlm(m, "Keyboard : Posture"), pairwise ~ Keyboard : Posture) # don't do this in ART!
29
30library(phia)
31testInteractions(artlm(m, "Keyboard:Posture"), pairwise=c("Keyboard", "Posture"), adjustment="holm")
32
33art.con(m, ~ Keyboard * Posture, adjust="holm")
References
#greenhouse_geyser #interactions #counterbalancing #design #week7 #non_parametric #align #eta_squared #sphericity #rlang #art #coursera #designing_running_and_analyzing_experiments #anova #test #experiment #statistics #theory