Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • set seed problem

    Hello Statalist,

    I recently came up with a replicability problem when using someone else's Do-File.

    It seems my Stata is assigning different random numbers after "gen random = runiform()" even when the seed on both computers is the same.

    Code:
    set seed 875511
    gen random=runiform()
    
    br if random<0.001
    I get only two observations popping up, while my collegue gets 5.

    Can anyone give me an explanation for this? I am using Stata 14, while she uses Stata 13.

    Thank you in advance

  • #2
    From

    Code:
    help whatsnew13to14
    15. New random-number generators (RNGs)

    Existing function runiform() now uses the 64-bit Mersenne Twister. runiform() produces uniformly
    distributed random numbers, and the functions providing random numbers for other distributions use
    runiform() in producing their results. Thus, all of Stata's RNGs are now based on the Mersenne Twister,
    too. Stata previously used KISS32 and still does under version control.
    Best
    Daniel

    Comment


    • #3
      Hello Daniel,

      Thanks for the information.

      Any other way to create random numbers and make it replicable even among different Stata versions? This is for future purposes.
      As for the present problem, any way to set my Stata 14 to use Stata 13 RGNs? So I can get same numbers from a runiform() function as my collegue?

      Thanks in advance
      Best regards.

      Comment


      • #4
        Daniel has already shown you the answer to that. Pay attention to:

        Stata previously used KISS32 and still does under version control.
        See -help version-.

        Comment


        • #5
          Thank you both for your comments.

          Code:
          version 13
          at the beginning of the code should work.

          Best regards.

          Comment

          Working...
          X