[Rd] Kinderman-Ramage (PR#2846)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Apr 25 14:15:31 MEST 2003
Unfortunately it was the default prior to 1.7.0, so for reproducibility I
think we can't change this. We could add a new option, a corrected
version, but is it worth it? I would definitely add a warning if the
buggy version was selected, and perhaps make it an error to select it via
RNGkind (rather than RNGversion or a saved .Random.seed).
On 25 Apr 2003, Peter Dalgaard BSA wrote:
> leydold at statistik.wu-wien.ac.at writes:
>
> > Hi,
> >
> > Our department has detected a bug in the implementation of the
> > Kinderman-Ramage generator for normal random variates in version
> > 1.7.0, which can be seen from the below R session.
> > (Consecutive calls for chisq.test(...) always gives p-values very
> > close to 0.)
> > We have already encountered this bug in version 1.6.2
> >
> > The error is in file
> > R-1.7.0/src/nmath/snorm.c
> >
> > Here is a patch for this file to correct the error
> > (the added two lines are crucial):
>
> Thanks. Both look like transcription errors. What was the source of
> the corrected constants? The JASA paper cited in snorm.c?
>
> (Another way of seeing the effect is
>
> m <- sapply(1:50,function(i)table(trunc(100*pnorm(rnorm(1e6)))))
> matplot(m,type="l")
>
> Two small, but clear, spikes at around 30 and 70 can be seen. The
> effect is not seen with the Inversion method, which is the default in
> R-1.7.0.)
>
>
>
--
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list