[R] Random sampling while keeping distribution of nearest neighbor distances constant.
Emmanuel Levy
emmanuel.levy at gmail.com
Thu Aug 13 00:05:24 CEST 2009
Dear All,
I cannot find a solution to the following problem although I imagine
that it is a classic, hence my email.
I have a vector V of X values comprised between 1 and N.
I would like to get random samples of X values also comprised between
1 and N, but the important point is:
* I would like to keep the same distribution of distances between the X values *
For example let's say N=10 and I have V = c(3,4,5,6)
then the random values could be 1,2,3,4 or 2,3,4,5 or 3,4,5,6, or 4,5,6,7 etc..
so that the distribution of distances (3 <-> 4, 3 <->5, 3 <-> 6, 4 <->
5, 4 <-> 6 etc ...) is kept constant.
I couldn't find a package that help me with this, but it looks like it
should be a classic problem so there should be something!
Many thanks in advance for any help or hint you could provide,
All the best,
Emmanuel
More information about the R-help
mailing list