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

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Aug 13 02:04:20 CEST 2009


> -----Original Message-----
> From: Emmanuel Levy [mailto:emmanuel.levy at gmail.com]
> Sent: Wednesday, August 12, 2009 4:48 PM
> To: Nordlund, Dan (DSHS/RDA)
> Cc: r-help at stat.math.ethz.ch; dev djomson
> Subject: Re: [R] Random sampling while keeping distribution of nearest neighbor
> distances constant.
> 
> Dear Daniel,
> 
> Thank a lot for your suggestion. It is helpful and got me thinking
> more about it so that I can rephrase it:
> 
> Given a vector V containing X values, comprised within 1 and N. I'd
> like to sample values so that the *distribution* of distances between
> the X values is similar.
> 
> There are several distributions: the 1st order would be given by the
> function diff.
> The 2d order distribution would be given by
> diff(V[seq(1,length(V),by=2)]) and diff(V[seq(2,length(V),by=2)])
> The 3rd order distribution diff(V[seq(1,length(V),by=3)]) and
> diff(V[seq(2,length(V),by=3)]) and diff(V[seq(3,length(V),by=3)])
> The 4th order ....
> 
> I would like to produce different samples, where the first, or first
> and second, or first and second and third, or up to say five orders
> distance distributions are reproduced.
> 
> Is anybody aware of a formalism that is explained in a book and that
> could help me deal with this problem? Or even better of a package?
> 
> Thanks for your help,
> 
> Emmanuel
> 
> 

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?

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
 




More information about the R-help mailing list