Here is one way to do a paired permutation test:
perm1 - function(x,y){
rb - rbinom(length(x),1,0.5)
xp - ifelse(rb==1, x, y)
yp - ifelse(rb==1, y, x)
ks.test(xp,yp)$statistic
}
my.x - rnorm(100)
my.y - my.x + rnorm(100, 0.2, 0.1)
mystat -
Dear List,
I am new to R and find it very powerful. I would like to compute the
permutational p-value for paired data using Kolmogorov-Smirnov, but
the built-in ks.test does not have this option, unlike the t.test
which has a paired=TRUE flag. Has someone written a library or a
routine that does