Re: Matlab's random number generator is suspicious... what to do?



One additional thought.
How did you run it? In one procedure (10 000 000 (?) ) monte carlo
simulations?
If you run two copies of MATLAB (5000000 & 5000000) simulations to get these
results, and did not bother to reinitialize the random number generator, you
should obtain EXACTLY THE SAME results. Just because MATLAB by default
generates the same sequence of 'random' numbers every time you start it.

Arthur

"Randy Poe" <poespam-trap@xxxxxxxxx> wrote in message
news:1152292420.208055.294420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

gino wrote:
"Rune Allnor" <allnor@xxxxxxxxxxxx> wrote in message
news:1151737171.192977.91330@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

gino wrote:
I did some Monte Carlo simulation,

with some random data,

for 5000 thousands runs, the result is extremely good;

and for another 5000 thousands runs, the result is extremely bad...

this makes me suspect the randomness of the Matlab's random number
generator... (I am trying to generate some Geometric Brownian Motion
process)...

Are they ways that I can make Matlab's random number generator better?

First: I don't see very often that people actually check how Monte
Carlo simulations perform. Too many people take for granted that
MCS is "best" and use the results uncritically.

So good work on you for actually checking, and evaluating the
results.

Now, just out of curiosity, what makes you conclude that

a) There is a problem with your Monte Carlo simulations?
b) The cause of this as of yet unknown problem has to
do with matlab?



Thanks Rune,

the symptom was sometimes the result was extremely good,

Define "extremely good"

and all results
clustered together. and some other times the results were extremely bad,

Define "extremely bad"

and
all results clustered together again.

You've said the results were clustered in both cases. What
about the first case was "good" and the second case was
"bad"?

Also you've only told us the RESULTS were clustered, nothing
about the random numbers.

RAND and RANDN are pretty good PRNGs. I wouldn't
automatically conclude they are at fault without further
analysis of what happened in the "bad" runs.

- Randy



.



Relevant Pages

  • Re: Matlabs random number generator is suspicious... what to do?
    ... Are they ways that I can make Matlab's random number generator better? ... The cause of this as of yet unknown problem has to ... the default generator in MATLAB. ... different scaling method might make all the difference. ...
    (comp.soft-sys.matlab)
  • Re: rand function
    ... it activates the VERY OLD multiplicative congruential uniform random number generator that was originally introduced in MATLAB V4 and deprecated in MATLAB V5. ... it initializes that generator with the seed value 9, and every time you run that command, the RAND function will subsequently return exactly the same sequence of values. ... So if you've already activated one of the old generators using the pre-8b syntax in R2008b or later, you likely want to restart in a fresh MATLAB session, or do the following to reset things as if you had restarted: ...
    (comp.soft-sys.matlab)
  • Re: Weird problem with fmincon on 2008b
    ... I am simulating a data generating process hence the use of randn. ... Everything goes well until I open up a second instance of Matlab 2008b (in ... Start one session of MATLAB and perform some operations involving RAND, ... pseudorandom number generator in the two sessions are not in the same state. ...
    (comp.soft-sys.matlab)
  • Re: How to generate proper seeds for the rand function in Monte Carlo
    ... Most people do not realize that the 'state' in that command corresponds to a specific, and out of date, generator. ... In MATLAB since R2008b, the Mersenne Twister is what you get at startup, and you can do this at the beginning of each simulation run to reseed the generator: ... So not only should you not execute the command rand, you also should not execute the command randn. ...
    (comp.soft-sys.matlab)
  • Re: Controlling Multi-processing in MATLAB
    ... I've found in MATLAB 2009b and 2010a that MATLAB automatically uses multi-core and it would seem the majority of my code is parallelize and thus I never seem to have a free core during simulations. ...
    (comp.soft-sys.matlab)