Often when we analyze data, we would like to know whether the mean of our sample distribution is different from some theoretical value or expected average. Suppose we measured the height of 12 females and wanted to know if the average we calculated from our sample population is significantly different from the theoretical average height of females, which is 171 cm. A simple test we could perform to test this hypothesis would be the Wilcoxon signed-rank test. To do this in R, we will use the
wilcox.test() function with the
mu argument set to
> female.heights <- c(117, 162, 143, 120, 183, 175, 147, 145, 165, 167, 179, 116) > mean(females.heights)  151.5833 > wilcox.test(female.heights, mu=171) Wilcoxon signed rank test ...