The sequences obtained by this method are not uniform and,
more importantly, are not iid.
S
-----Original Message-----
From: David L Lorenz [mailto:lorenz@usgs.gov]
Sent: Monday, November 22, 2004 11:12 AM
To: David L Lorenz
Cc: carcappe@unina.it; s-news@lists.biostat.wustl.edu;
s-news-owner@lists.biostat.wustl.edu
Subject: Re: [S] sampling from an uniform with a minimum distance
between the
Melina,
Sorry again. I just remembered that the method that I have seen
recommended for this particular problem is to sequentially add random
numbers that satisfy the separation criterion. This is not efficient in
terms of S+ programming. But, I believe that it produces a distribution
that is more nearly uniform in distribution.
Here's a snippet of code that generates 6 random numbers separated by at
least 1 on a uniform distribution from 0 to 10:
x3.1 <- runif(1,0,10)
for(j in 2:6) {
x3.2 <- runif(1,0,10)
while(min(diff(sort(c(x3.1, x3.2)))) < 1)
x3.2 <- runif(1,0,10)
x3.1 <- c(x3.1, x3.2)
}
Dave
"David L Lorenz"
<lorenz@usgs.gov> To:
carcappe@unina.it
Sent by: cc:
s-news@lists.biostat.wustl.edu,
s-news-owner@lists.biosta
s-news-owner@lists.biostat.wustl.edu
t.wustl.edu Subject: Re: [S]
sampling from an uniform with a minimum distance between
the
11/22/2004 09:47 AM
Melina,
I am not sure that this simple approach gives a uniform distribution. I
believe that the random numbers that are selected using that procedure
results in a higher number of values that are close to the limits of the
distribution. This effect is more pronounced as the spacing gets to be a
larger proportion of the limits of the distribution. If it is very small,
then the effect is negligible.
Sorry, I do not have an unbiased method.
Dave
carcappe@unina.it
Sent by: To:
s-news@lists.biostat.wustl.edu
s-news-owner@lists.biosta cc:
t.wustl.edu Subject: [S]
sampling from an uniform with a minimum distance between the
sampled values
11/21/2004 10:59 AM
Many thanks to Henrik Nielsen, James Hotlman, Simon Rosenfeld and Alan
Gross
for replaying to my message.
A special thank to Juhlin Kenton and Greg Snow who gave me the right hint
to
sort the problem out.
the right script is
if (min(range(diff(sort(x))))<c)
melina
Carmela Cappelli
Department of Statistics, School of Political Science
University of Naples Federico II
phone: +39-081-2537553
fax:+39-081-2537466
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|