[R] permutation test on paired samples

Holger Taschenberger Holger.Taschenberger at mpi-bpc.mpg.de
Thu Jul 12 20:26:45 CEST 2012


Hi,

        I'm trying to run a permutation test on paired samples. 

First I tried the package "exactRankTests":

require("exactRankTests")
x <- c(1.83,0.50,1.62,2.48,1.68,1.88,1.55,3.06,1.30)
y <- c(0.878,0.647,0.598,2.05,1.06,1.29,1.06,3.14,1.29)
wilcox.test(x,y,paired = TRUE,alternative = "greater")
perm.test(y,x,paired = TRUE,exact = TRUE,alternative = "greater")

Then I wanted to use the package 'coin':

require("coin")
x <- c(1.83,0.50,1.62,2.48,1.68,1.88,1.55,3.06,1.30)
y <- c(0.878,0.647,0.598,2.05,1.06,1.29,1.06,3.14,1.29)
xydat <- data.frame(y = c(y,x),x = gl(2,length(x)),block = factor(rep(1:length(x),2)))
wilcoxsign_test(y ~ x | block,data = xydat,alternative = "greater",distribution = exact())
oneway_test(y ~ x | block,data = xydat,alternative = "greater",distribution = exact())

While the results of the Wilcoxon test are the same for both packages
are the same, those of the permutation test are very different. So,
obviously I'm doing something wrong here. Can somebody please help?

Thanks a lot,
        Holger



More information about the R-help mailing list