Test the ANOVA assumptions
Independence
This is just guaranteed by sound experiment design
Normality
To test the ANOVA assumption of normality, we can use the shapiro-wilks test on the residuals. A significant results indicates departures from normality.
1shapiro.test(ide2[ide2$IDE == "VStudio",]$Time)
2shapiro.test(ide2[ide2$IDE == "Eclipse",]$Time)
3
4#
5
6m = aov(Time ~ IDE, data=ide2) # fit model (linear regression)
7shapiro.test(residuals(m)) # test residuals
8qqnorm(residuals(m)); qqline(residuals(m)) # plot residuals
qqnorm
creates a Q-Q plot (quantile of normal distribution VS quantile of data)
Homoscedasticity
We can use Levene’s test for homogeneity of variance. Again, here stat. sig. mean violation of homoscedasticity.
Brown-Forsythe test does the same as Levene’s but uses the median instead of the mean and is considered more robust.
When homoscedasticity is violated, we can run a Welch t-test, which doesn’t require this assumption. However normality of residuals is still required:
1t.test(Time ~ IDE, data=ide2, var.equal=FALSE) # Welch t-test
References
#statistics #week4 #designing_running_and_analyzing_experiments #assumptions #test #coursera #experiment #theory #control #ab_test #shapiro #normality #design #anova #rlang