Re: [R] Worm distribution :-)

From: Jim Lemon <>
Date: Tue 24 Oct 2006 - 10:44:11 GMT

Alberto Monteiro wrote:
> I don't know if anyone has heard this tale, but it runs
> more or like this way:
> A biologist was studing a (semi-spherical) cave where bats
> lives. He fell asleep in the cave, and he woke up in the
> middle of the night. Half-dreaming, he thought that he was
> outside, because glow-worms were living in the walls, and
> they looked like stars. However, he noticed that, unlike a
> real sky, these "stars" had no _pattern_: there were no
> recognized images like The Cross, a Scorpion, The Hunter, etc.
> When he woke up, he conjectured that the reason we _can_
> see patterns in the real sky is that the stars are randomly
> distributed, while the glow-worms tried to keep a distance
> to each other.
> My question: what is the best way to generate a glow-worm-like
> distribution? I imagine that using a Latin Hypercube would
> leave too many holes in the (x,y) plane.
Hi Alberto,

I once had to do this to generate "random dot stereograms" for perception experiments. One easy way is to build from one corner or edge (almost all these are rectangular, you can just clip out the figure you want later). The user defines a "hit" area for each successive point that contains the minimum and maximum allowable distances from the two nearest points (typically a small square). Points can be generated with two uniform random numbers having a mean of the distance to the center of the "hit" area and a range spanning the "hit" square. It was easy to churn out constrained random dot patterns on the fly with this method.

I no longer have the FORTRAN code that performed this, but I could probably knock it up in C or R if you're stuck for a method.

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue Oct 24 20:50:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 24 Oct 2006 - 11:30:13 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.