My samples are independent and consist of 8 observations. The values are
discrete and measured on ordinal scale. I found the following example for an WMW
test online but I do not know how to write a function to be supplied to the boot
command:
# Run Wilcoxon Exact Test
#
# Create X and Y variables
x <- c(76.375, 75.125, 77, 77, 77, 76.375, 77, 76.375)
y <- c(76.375, 75.75, 76.375, 76.375, 76.375, 75.75, 77, 76.375)
print(nx <- length(x))
print(ny <- length(y))
data <- c(x, y)
names(data) <- c(rep("x", nx), rep("y", ny))
data <- sort(data)
r <- rank(data)
# Printout data and ranks in X and Y
rbind(data, r)
# Wilcoxon W statistic
print(w <- sum(r[names(data) == "y"]))
# Umrechnen in Mann-Whitney U statistic
print(u <- w - ny * (ny + 1) / 2)
# Get probability from Wilcoxon distribution m=8, n=8
pwilcox(u, nx, ny)
# Perform two-sided exact test
wilcox.exact(y, x, alternative="two.sided")
Thanks in advance
Stefan
---
Stefan Strecker
Universitaet Karlsruhe (TH)
Department of Economics and Business Engineering
Chair for Information Management and Systems
Englerstrasse 14
D-76131 Karlsruhe, Germany
T: +49 721 608 8374
F: +49 721 608 8399
M: +49 179 69 29 746
http://www.iw.uni-karlsruhe.de
DH PGP Key available upon request