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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Robin Hankin <r.hankin at auckland.ac.nz> writes:> 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?This is also illuminative: plot(sort(sapply(rep(2000,2000),f)),type="l") We've seen odd behaviour of max(rnorm()) with the default random generators before. Switching to RNGkind("Wichmann-Hill") made the effect disappear here. Same thing switching the normal generator with RNGkind("Marsaglia-Multicarry","Box-Muller"). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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.This is substantially the same as PR#1664. The Marsaglia-Multicarry and Kinderman-Ramage options don't play nicely together in the extreme tails of the Normal distribution. Changing the Normal generator RNGkind(normal="Inversion") RNGkind(normal="Box-Muller") or the underlying uniform stream RNGkind(kind="Wichmann-Hill") RNGkind(kind="Super-Duper") gives better looking results. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
rziggurat() does not exhibit this behavior and is quite a bit faster. 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Bob Wheeler --- (Reply to: bwheeler at echip.com) ECHIP, Inc. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
So, where is rziggurat()? --Ivan Frohne ----- Original Message ----- From: "Bob Wheeler" <bwheeler at echip.com>> rziggurat() does not exhibit this behavior and is quite a > bit faster.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._