# Testing for equal medians for more than two independent populations #Set working directory setwd("~/Dropbox/ISI SCB/Data sets") # read in csv file th <-read.csv("tours.csv", TRUE) Time <- th$Minutes Tourguide <-th$Tour #Display the data in boxplots boxplot(Time~Tourguide) # Kruskal-Wallis Test: #One-Way Analysis of Variance by Ranks kruskal.test(Time~Tourguide) #Completely Randomised Design: one-way ANOVA th.aov<- aov(Time~Tourguide) summary(th.aov) #check for normality and equal variances for one-way ANOVA res <- th.aov$residuals qqnorm(res, ylab = "Residuals Sample Quantiles") shapiro.test(res) #residual plot to assess constant variance assumption res <- th.aov$residuals fit <- th.aov$fitted.values plot(fit,res, main="Residual Plot",xlab= "Fitted Values", ylab="Residuals") #Levene's Test to assess constant variance assumption library(car) leveneTest(th.aov)