Announcement

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

  • seed no

    Hello all, I have a dataset of 800,000 observations.

    I am using the entire dataset for propensity scores

    To give me consistent results I am using the seed function . does it matter if my seed is 1234 rather than 1234567 (i.e greater than 800,000)


    Set seed 1234

    Gen sort_id = uniform()

    Sort sort_id

  • #2
    There's been some discussion on the list and maybe on StataCopr's website for choosing random number generator seeds; you could probably Google it.

    The bigger problem, though, is using the default single-precision floating point for your sorting variable.


    . seedem
    set seed 396903423

    . quietly set obs 800000

    . generate float sort_id = runiform()

    . isid sort_id
    variable sort_id does not uniquely identify the observations
    r(459);

    . recast double sort_id

    .
    . set seed 396903423

    . quietly replace sort_id = runiform()

    . isid sort_id

    .


    Chalk up yet another one for making double-precision the default for Stata, the last holdout among statistical packages (commercial or otherwise), spreadsheet applications, programming languages and any other software where data are important.

    Comment


    • #3
      I didn't really understand your response to my question.

      recast double sort_id //what does this do?

      .
      . set seed 396903423 ///why did you randomly choose this number

      . quietly replace sort_id = runiform()

      . isid sort_id

      Comment


      • #4
        Originally posted by Martin Imelda Borg View Post
        recast double sort_id //what does this do?
        It converted the datatype of sort_id from single-precision to double-precision floating point numeric. The command is used generally to convert datatype of a variable after the variable has been created.
        Code:
        help recast
        for more information.

        set seed 396903423 ///why did you randomly choose this number
        I didn't. It was generated for me by the immediately preceding command, which I wrote but have not distributed.

        If you want truly random seeds, then you can look into this user-written command* (introduced here).

        *Note that you might have to slightly tinker with it, because the URL for the random number source has changed since the user-written command was put up on SSC. See this post for how to fix it in case the command hasn't been updated to call the source's new URL.

        Comment

        Working...
        X