# Data: Eight daily temperatures (degrees C) at a South Florida weather station # and at an experimental pasture site. Of interest is whether the median difference is zero. # Source: Rao (1998), p. 187. weather <- c(34.5,35.4,35.9,33.4,36.9,35.8,36.0,37.4) pasture <- c(33.2,32.9,33.4,32.3,34.1,33.0,33.3,34.6) # Let differences = weather - pasture: diffs <- weather - pasture hist(diffs) # Histogram qqnorm(diffs) # Q-Q plot shows non-normality wilcox.test(diffs, alternative="two.sided", mu=0) # The Wilcoxon Signed Rank test on the differences concludes # (at significance level .05) that the true median difference is not 0. # P-value given as 0.01368. ###################################################################### # What if we had been testing whether the true median difference # was GREATER than 0 (i.e., weather station temperatures higher)? wilcox.test(diffs, alternative="greater", mu=0) # The Wilcoxon Signed Rank test on the differences concludes # (at significance level .05) that the true median difference is greater than 0. # P-value given as 0.0068.