Hello!
I am looking at a randomization file in which no seed was set and am trying to recreate it.
The randomization is created through two steps:
1) Sorting by two characteristics (that make the sorting non-unique)
2) Drawing a bunch of runiforms
The Stata help code on "set seed" gives me the following information: "The sequences the random-number functions produce are determined by the seed, which is just a number and which is set to 123456789 every time Stata is launched. This means that runiform() produces the same sequence each time you start Stata. The first time you use runiform() after Stata is launched, runiform() returns 0.348871704556195. The second time you use it, runiform() returns 0.266885709753138. The third time you use it, ...."
Hence, I was thinking that I have to just write a code that keeps running the randomization do-file until the outcome assignment matches the actual assignment - thus, basically just run the do-file as many times as did the person who wrote initially wrote and ran it. However, this is ignoring point 1. I was assuming that when stata "randomly" orders observations within a non-unique sorting, it also uses the same algorithm as for a random distribution without a seed. However, this does not seem to be the case. Does anyone know how I could try recreate the sorting? How is Stata doing the randomization with the sort command without the option stable?
Thank you very much!!
I am looking at a randomization file in which no seed was set and am trying to recreate it.
The randomization is created through two steps:
1) Sorting by two characteristics (that make the sorting non-unique)
2) Drawing a bunch of runiforms
The Stata help code on "set seed" gives me the following information: "The sequences the random-number functions produce are determined by the seed, which is just a number and which is set to 123456789 every time Stata is launched. This means that runiform() produces the same sequence each time you start Stata. The first time you use runiform() after Stata is launched, runiform() returns 0.348871704556195. The second time you use it, runiform() returns 0.266885709753138. The third time you use it, ...."
Hence, I was thinking that I have to just write a code that keeps running the randomization do-file until the outcome assignment matches the actual assignment - thus, basically just run the do-file as many times as did the person who wrote initially wrote and ran it. However, this is ignoring point 1. I was assuming that when stata "randomly" orders observations within a non-unique sorting, it also uses the same algorithm as for a random distribution without a seed. However, this does not seem to be the case. Does anyone know how I could try recreate the sorting? How is Stata doing the randomization with the sort command without the option stable?
Thank you very much!!
Comment