seed for Monte Carlo

23 visualizaciones (últimos 30 días)
charisios grivas
charisios grivas el 4 de Dic. de 2019
Comentada: Jeff Miller el 4 de Dic. de 2019
I am running a Monte carlo simulation and I have set the seed outside the monte carlo simulation. However, one of my basic assumptions is that two variables are independent. I am wondering whether the two variables generated by using the same seed will be dependent so that I will have to change the seed for each iteration of the monte carlo simulation. If the latter holds, how do i do that? I have calculated the correlation between the two and it is close to 0.(However zero correlation does not imply independence)

Respuestas (1)

Jeff Miller
Jeff Miller el 4 de Dic. de 2019
It sounds like you would be better off not to set the seed at all--just use MATLAB's default seed, which is different every time it starts.
Usually the only reason for setting the seed is to make sure that you can recreate the same set of random values in a later run, and it doesn't sound like you want to do that.
  2 comentarios
Guillaume
Guillaume el 4 de Dic. de 2019
"just use MATLAB's default seed, which is different every time it starts."
Hum, no actually. Matlab default seed is always the same: 0. If you restart matlab, you're guaranteed to get the exact same sequence of numbers every time.
The easiest way to make sure you get a different random sequence every time you restart matlab is with:
rng('shuffle')
On the other hand, if you don't restart matlab between runs of the monte-carlo simulation, it doesn't really matter what the starting seed was, the numbers will be random from run to run, as long as you don't reset the seed between each run.
Jeff Miller
Jeff Miller el 4 de Dic. de 2019
Yikes, that's good to know. Will add rng('shuffle') to my startup.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by