Re: [R] Worm distribution :-)

2006-10-24 Thread Jim Lemon
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

__
R-help@stat.math.ethz.ch 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.


Re: [R] Worm distribution :-)

2006-10-24 Thread rolf
Jim Lemon wrote (in response to a question from Alberto Monteiro):

 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.

This appears to be:

(a) closely related to the ideas of ``partially ordered
Markov models'' developed by Noel Cressie et al (see, e.g.
Cressie, N., Zhu, J., Baddeley, A. J., and Nair, M. G.
Directed Markov point processes as limits of partially
ordered Markov models. Methodology and Computing in Applied
Probability, 2, 5-21).

(b) re-invention of the wheel.  As I pointed out in a
previous posting to the list there are a brazillion ways of
generating point patterns with interpoint inhibition, readily
available in R.

cheers,

Rolf Turner
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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.


[R] Worm distribution :-)

2006-10-23 Thread Alberto Monteiro
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.

Alberto Monteiro

__
R-help@stat.math.ethz.ch 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.


Re: [R] Worm distribution :-)

2006-10-23 Thread rolf
You are talking about random point patterns, since the glow-worms
appear as ``stars'' (= points).   See the package ``spatial'' (which
comes with R) and try simulating a pattern using Strauss().

Or install the package ``spatstat'' from CRAN --- in this package
there is a variety of ways to simulate ``regular'' random point
patterns --- rMaternI, rMaternII, rSSI, and rmh (which simulates
several point pattern models depending on the specified Papangelou
conditional intensity function).

cheers,

Rolf Turner
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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.


Re: [R] Worm distribution :-)

2006-10-23 Thread Ana Nelson
Have you heard of Boids? (google it if not) Depending upon what you  
want this for a simulation approach might be appropriate.

Regards,
Ana Nelson



On 23 Oct 2006, at 18:18, 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.

 Alberto Monteiro

 __
 R-help@stat.math.ethz.ch 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.

__
R-help@stat.math.ethz.ch 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.