From: Stas Kolenikov <skolenik_at_gmail.com>

Date: Sat, 26 Apr 2008 18:10:44 -0500

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. Received on Sat 26 Apr 2008 - 23:16:23 GMT

Date: Sat, 26 Apr 2008 18:10:44 -0500

You might want to shuffle coordinates independently to get rid of the diagonals. Otherwise what quasi-random sequence guarantee are upper boundaries on the coverage errors, but not anything nice-looking and irregular. Sobol' sequences, even though they are theoretically superior to some others (e.g., Halton sequences more popular among economists), are especially nasty in producing bands and bricks on the low dimensional plots.

Among statisticians, Art Owen from Stanford is almost the only one interested in this sort of stuff (referred to as quasi-Monte Carlo, in his field(s)). You might have better luck on a physics list with a question like yours.

On Sat, Apr 26, 2008 at 5:22 AM, baptiste Auguié <ba208_at_exeter.ac.uk> wrote:

> Dear list useRs,

* >
** > I have to generate a random set of coordinates (x,y) in [-1 ; 1]^2
** > for say, N points. At each of these points is drawn a circle (later
** > on, an ellipse) of random size, as in:
** >
** >
** > > N <- 100
** > >
** > > positions <- matrix(rnorm(2 * N, mean = 0 , sd= 0.5), nrow=N)
** > > sizes<-rnorm(N, mean = 0 , sd= 1)
** > > plot(positions,type="p",cex=sizes)
** >
** >
** > My problem is to avoid collisions (overlap, really) between the
** > points. I would like some random pattern, but with a minimum
** > exclusion distance. In looking up "Numerical recipes in C", I found
** > out about some Sobol quasi-random sequences, which one can call from
** > the gsl package,
** >
** >
** > > library(gsl)
** > >
** > > g <- qrng_alloc(type="sobol",dim=2)
** > > qrng_get(g,n= N) ->xy
** > >
** > > plot((xy),t="p",cex=0.5)
** >
** > but this does not look very random: I clearly see some pattern
** > (diagonals, etc...), and even the non-overlapping condition is not
** > impressive.
** >
** > One (painful) way I can foresee is to check the distance between each
** > symbol and the others, and move the overlapping ones in a recursive
** > manner. Before delving into this, I wanted to check I'm not
** > overlooking something in the rgl quasi-random sequences, or missing a
** > more obvious way to generate such patterns. Perhaps solving an
** > electrostatic problem with a potential both attractive at long
** > distances and repulsive at short distances is a better way? I have a
** > vague recollection of hearing that somewhere to position points
** > evenly on a sphere.
** >
*

--

Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I don't check Gmail account regularly.

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. Received on Sat 26 Apr 2008 - 23:16:23 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Sun 27 Apr 2008 - 00:30:31 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*