[R] Random sampling while keeping distribution of nearest neighbor distances constant.

Emmanuel Levy emmanuel.levy at gmail.com
Thu Aug 13 02:51:27 CEST 2009


> But if the 1st order differences are the same, then doesn't it follow that the 2nd, 3rd, ... order differences must be the same between the original and the new "random" vector.  What am I missing?

You are missing nothing sorry, I wrote something wrong. What I would
like to be preserved is the distance with the *nearest* neighbor, so
diff is not the way to go. If you only consider the nearest neighbor,
then

c(3,4, 8,9) and c(4,5,6,7) are the same in terms of first order (all
closest neighbor are 1 unit away) but not in terms of second order.

Also, I don't know if there would be a simple way to maintain a
*distribution* of distances (even if not of nearest neighbor).
For example, c(2,4,5,6) could be c(1,3,4,5), c(3,5,6,7) as proposed by
your solution, but it could also be: c(4,5,6,8)
Or, c(2,3,6,7,8) could be c(2,3,4,7,8)

Actually, that's really simple! I can simply resample the "diff" vector!

OK so the only problem becomes the 1st, 2d, 3rd order thing now, but
you made me realize that I can skip it for the moment.

Thank you! :-)

Emmanuel



>
> Dan
>
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA  98504-5204
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list