Dear colleague,
unfortunately 'rnorm' does not create normal distributed numbers as
you can see with following histogramm:
> hist(rnorm(1000000),breaks=100)
and
> hist(pnorm(rnorm(1000000)),breaks=100)
I have done several chi^2-tests which have all failed:
> chi2unif<- function(x,N)
> {
> anz=length(x)
> f0<-rep(anz/N,times=N)
> fi<-(hist(x,g<-seq(length(N+1),from=0, by=1/N), plot=FALSE)[2])
> fin<-fi[[1]][1:N]
> chi2=sum( ((f0-fin)^2)/f0 )
> pchisq(chi2,N-1)
> }
> chi2unif(x<-pnorm(rnorm(1000000)),100)
The result is the p-value of a goodness of fit test (chisquare test).
It should be a uniform random number in [0,1].
However, if this test is repeated, one almost every time gets an
number near one (0.99...)
This problems happens only by using normal.kind="Kindermann-Ramage"
(the default). This bug also appears in all random variate generation
that depend on 'rnorm', like 'rgamma'.
With regards,
G�nter Tirler
--
-----------------------------------------------------------------------------
G�nter Tirler | University of Economics and Business Administration
| Department for Applied Statistics and Data Processing
-----------------------------------------------------------------------------
Augasse 2-6 | Tel. *43/1/31336-4840
A-1090 Vienna | FAX *43/1/31336-738
Austria | email [EMAIL PROTECTED]
-----------------------------------------------------------------------------
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel