## Section 5.3 examples #### Example 1: Current <- c(10.8, 11.1, 10.4, 10.1, 11.3) New <- c(10.8, 10.5, 11.0, 10.9, 10.8, 10.7, 10.8) # Talwar-Gentle approach: # caluclating the absolute deviations: absdevCurrent <- abs(Current-mean(Current)) absdevNew <- abs(New-mean(New)) # Mann-Whitney test on the absolute deviations: wilcox.test(absdevCurrent, absdevNew, alternative="greater", paired=F, exact=T) # Fligner-Killeen test: fligner.test(list(Current, New)) #### Example 2: ## Data given as labeling vector of golf ball brands ## and numeric vector of distances the balls traveled when hit brand<-c('A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D') dist <- c(251.2,263.2,269.7,251.6,245.1,262.9,263.2,248.6,248.0,265.0,277.5,249.4,251.1,254.5,267.4,242.0,260.5,264.3,270.5,246.5,250.0,257.0,265.5,251.3,253.9,262.8,270.7,261.8,244.6,264.4,272.9,249.0,254.6,260.6,275.6,247.1,248.8,255.9,266.5,245.9) # Talwar-Gentle approach: brandA <- dist[brand=='A'] brandB <- dist[brand=='B'] brandC <- dist[brand=='C'] brandD <- dist[brand=='D'] absdevA <- abs(brandA-median(brandA)) absdevB <- abs(brandB-median(brandB)) absdevC <- abs(brandC-median(brandC)) absdevD <- abs(brandD-median(brandD)) kruskal.test(list(absdevA,absdevB,absdevC,absdevD)) # Fligner-Killeen test: fligner.test(dist ~ factor(brand))