Tuesday, May 8, 2012

A note on generating random numbers

The ‘set seed’ command tells Stata where to begin drawing random numbers from. In order to understand this you must keep in mind that Stata cannot generate truly random numbers but can only draw numbers that look random. (This is the limitation of binary computers.  If Stata were running on a quantum computer then truly random numbers could be possible.)

There is a benefit in this however.  Numbers that look random but are not but are sufficiently close to being random to give us the ability to make inference about how a random number would work.  The true benefit of not dealing with random number is that these numbers can be replicated.
This is extremely convenient in that it allows two researchers in two different parts of the world to run the same simulation and get the exact same results.  In general the exactness of the results is trivial.  However, it is extremely useful to know that you can change parameters this way or that way, but that the underlying 'random' draw remains the same.  Likewise, if a researcher in a different part of the world were to run the same simulation with different parameters, it is likely that the differences between the two simulations is caused by the change in parameters, not the change in the random draws.

No comments:

Post a Comment