Re: [R] ties in runif() output

2004-06-26 Thread Douglas Grove
On Sat, 26 Jun 2004, Prof Brian Ripley wrote:

> On Fri, 25 Jun 2004, Douglas Grove wrote:
> 
> > I get ties in output from runif() when I generate as few as 10^5
> > variates and get quite a lot when I generate 10^6.  Is this 
> > expected??  
> 
> It should have been.
> 
> > I haven't seen any duplication with rnorm(10^6), but
> > see varying amounts of duplication using rexp(), rbeta() and
> > rgamma().  I would have thought that there'd be enough precision
> > that one wouldn't get ties until generating samples larger than this..
> 
> Did you do the calculations?  Please do so. There are about 2e9 possible
> values of the standard generators.

I know little about the limitations of random number generation 
and didn't realize that only 2e9 values were obtainable.
I could have done the math myself had I known

Thanks very much for your help,
Doug


> > qbirthday(classes=2e9)
> [1] 52655
> 
> Statisticians ought to know about the birthday problem!
> 
> (rnorm is different because the default generator uses two uniforms, 
> deliberately to increase the precision.)
> 
> > > set.seed(222)
> > > sum(duplicated(runif(10^5)))
> > [1] 4
> 
> That's unusually high, BTW.
> 
> > > sum(duplicated(runif(10^6)))
> > [1] 140
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] ties in runif() output

2004-06-25 Thread Prof Brian Ripley
On Fri, 25 Jun 2004, Douglas Grove wrote:

> I get ties in output from runif() when I generate as few as 10^5
> variates and get quite a lot when I generate 10^6.  Is this 
> expected??  

It should have been.

> I haven't seen any duplication with rnorm(10^6), but
> see varying amounts of duplication using rexp(), rbeta() and
> rgamma().  I would have thought that there'd be enough precision
> that one wouldn't get ties until generating samples larger than this..

Did you do the calculations?  Please do so. There are about 2e9 possible
values of the standard generators.

> qbirthday(classes=2e9)
[1] 52655

Statisticians ought to know about the birthday problem!

(rnorm is different because the default generator uses two uniforms, 
deliberately to increase the precision.)

> > set.seed(222)
> > sum(duplicated(runif(10^5)))
> [1] 4

That's unusually high, BTW.

> > sum(duplicated(runif(10^6)))
> [1] 140

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] ties in runif() output

2004-06-25 Thread Douglas Grove
I get ties in output from runif() when I generate as few as 10^5
variates and get quite a lot when I generate 10^6.  Is this 
expected??  I haven't seen any duplication with rnorm(10^6), but
see varying amounts of duplication using rexp(), rbeta() and
rgamma().  I would have thought that there'd be enough precision
that one wouldn't get ties until generating samples larger than this..


> set.seed(222)
> sum(duplicated(runif(10^5)))
[1] 4

> sum(duplicated(runif(10^6)))
[1] 140


platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status   Patched
major1
minor9.0
year 2004
month04
day  13
language R


Thanks,
Doug Grove

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html