[R] unexpected behaviour of rnorm()

Ravi Varadhan rvaradha at jhsph.edu
Wed Nov 27 23:18:40 CET 2002


Hi:

I am using R 1.5.1 on Windows, and the "Inversion" method for normal
generator doesn't exist in the "RNGkind" function.

I only see the following options inside the function:

c("Kinderman-Ramage", "Ahrens-Dieter", "Box-Muller",
        "user-supplied", "default")

Am I missing something?

Ravi.

----- Original Message -----
From: <ripley at stats.ox.ac.uk>
To: "Robin Hankin" <r.hankin at auckland.ac.nz>
Cc: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 26, 2002 5:04 PM
Subject: Re: [R] unexpected behaviour of rnorm()


> That's the maximum of 5000 normals, right?  That's pushing the accuracy of
> some internal calculations too hard.
>
> If you want to do this, you should use
>
> RNGkind(, "Inversion")
>
> That's not the default for back-compatibility reasons.
>
> On Wed, 27 Nov 2002, Robin Hankin wrote:
>
> > Hello everyone.
> >
> > If I do
> >
> > f <- function(n){max(rnorm(n))}
> > plot(sapply(rep(5000,4000),f))   #[this takes my PC about 30 seconds]
> >
> > then I get something quite unexpected: gaps in the distribution.  For
> > me, the most noticable one is at about 3.6.
> >
> > Do others get this?  Is it an optical illusion?  It can't be right,
> > can it?  Or maybe I just don't understand the good ol' Gaussian very
> > well.
> >
> > anyone got an explanation?
> >
> >
> > [linux redhat 7.1; R-1.6.1]
> >
> >
> >
> > --
> >
> > Robin Hankin, Lecturer,
> > School of Geography and Environmental Science
> > Tamaki Campus
> > Private Bag 92019 Auckland
> > New Zealand
> >
> > r.hankin at auckland.ac.nz
> > tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042
> >
> > as of: Wed Nov 27 09:15:00 NZDT 2002
> > This (linux) system up continuously for:  454 days, 14 hours, 57 minutes
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> > r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> >
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
> >
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> 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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list