MatLab randn and Simulation Step Numbers



Hi,

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.

My simulation is performed so simulated data points are binned in
intervals of 0.01 units (in units of sdev) from -3.5<z<3.5, so I have
N(i) data points in bin i=1,720. I have generated the appropriate
discretized Gaussian pdf, from which I can compute the number of data
points we would expect from a Gaussian distbtn, n(i). Using the
chi-square statistics Sum[ (N(i)-n(i))^2/n(i) ] from i = 1,...,720, I
then have a chi-squre distbtn with 719 degrees of freedom. I find that
as the total number of data points generated increases from 100 to
100,000, the chi-square statistics does not exhibit any type of
montonic behavior and generally increases as the number of data points
generated increases.

Is this a peculiarity with this random number generator? Has anyoe else
experienced this type of problem in the past? Looking at the difference
(N(i)-n(i)) plotted vs i (the bin #), it seems the plot oscillates
significantly, which led me to wonder if I am not binning my data too
closely.

Any suggestions would be greatly appreciated.

TIA,

Matt Brenneman

.



Relevant Pages

  • MatLab randn and Simulation Step Numbers
    ... as NI run into a strange problem: as the number of simulated data ... points increases, my chi-square statistics increases. ... discretized Gaussian pdf, from which I can compute the number of data ... points we would expect from a Gaussian distbtn, ...
    (sci.math)
  • Re: MatLab randn and Simulation Step Numbers
    ... and the older ("MATLAB 4 generator") version. ... > as NI run into a strange problem: as the number of simulated data ... > points increases, my chi-square statistics increases. ... > Matt Brenneman ...
    (sci.stat.math)
  • MatLab randn and Simulation Step Numbers
    ... as NI run into a strange problem: as the number of simulated data ... points increases, my chi-square statistics increases. ... Ndata points in bin i=1,720. ...
    (sci.stat.math)