The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* »

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: MatLab randn and Simulation Step Numbers
Replies: 2   Last Post: Apr 26, 2005 11:54 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Tom Lane

Posts: 315
Registered: 12/7/04
Re: MatLab randn and Simulation Step Numbers
Posted: Apr 26, 2005 11:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Herman Rubin" <> wrote in message
> In article <>,
> Matthew Brenneman <> wrote:

>>I am testing the MatLab routine randn which is supposed to generate
>>rv's ~ N(0,1). The test for lack of correaltion looks good, but when I
>>run a chi-square test to check that the simulated distbtn is the same
>>as N(0,1) I run into a strange problem: as the number of simulated data
>>points increases, my chi-square statistics increases.

> NOT surprising. Because of poor uniform random variables,
> the normal random variables are not normally distributed,
> and the bias is similar for different blocks. If it was
> just the bias, the chi-squared statistic would be proportional
> to the sample size. As there is variation also, it is not
> that great.

While this is potentially a concern with any computer-generated
pseudo-random numbers, we haven't found evidence that the MATLAB random
number generators have this problem. I'd be interested in seeing the code
that led to the original post, or other evidence like that.

The current MATLAB normal generator is based on Marsaglia's Ziggurat idea.
There is a critique of that generator in the article by Leong et al. in the
Journal of Statistical Software, volume 12:

They take issue with a relatively low period in a particular implementation
of the algorithm. The MATLAB implementation has a higher period, though, on
the order of 2^64 rather than 2^32.

-- Tom

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.