Displaying 1 result from an estimated 1 matches for "psis".
Did you mean:
phis
2009 May 20
1
Comparing spatial distributions - permutation test implementation
...eate nperm-1 replicates of the data (one is the original
observation)
d = rep(list(dataCod), nperm-1)
# Compute number of observations before to avoid doing that for every
replicate
n = nrow(dataCod)
require(plyr)
# Permute some observations and compute the syrjala stat for each
permutation
psis = ldply(d, .fun=function(x, n){
# choose indices of observations to swap
idx = sample(1:n, runif(1, min=1, max=n))
# swap observations
x[idx, 3:4] = x[idx, 4:3]
# compute syrjala stat
return(syrjala.stat(x))
}, n, .progress="text")
}
# Compute the syrjala stat for the observations...