[Rd] Kinderman-Ramage (PR#2846)
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Fri Apr 25 15:06:23 MEST 2003
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.)
--
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
More information about the R-devel
mailing list