Announcement

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

  • Psmatch2

    Hi,
    Everytime I run psmatch2 command, it generates a different model which then impact the further analysis (survival COX PH) I run on the matched sample. I am trying to finalize a paper and struggle to stabilize 1 version of my data set.
    I tried to use: set seed x but this does not work.

    Many thanks for your guidance
    Very best

  • #2
    Please run the psmatch2 command twice, and show us the output you get from it. Show the code you used too.

    Comment


    • #3
      Very often sorting is responsible. Do you use the sort command in your code?
      Best wishes

      (Stata 16.1 MP)

      Comment


      • #4
        This the code I am using:

        set seed 1
        psmatch2 raceb i.aged i.sex i.histo i.geogr, logit odds neighbor(1) ai(1) noreplace
        stcox raceb if _weight!=. , strata(_pscore)

        the psmatch2 produces same regression model but stcox generates different results

        Comment


        • #5
          Oh yeah. I forgot that my instructor reminded us to sort randomly with nn matching.

          What you want is to do
          Code:
          set seed 1
          g sort = runiform()
          sort sort
          and then run your matching code

          Comment


          • #6
            Hi Jared, many thanks.
            Still no success which may indicates that the pscore generated is different every time . The stcox keeps returning different results.
            If I push the logic further, should I run XX (eg. 5000) simulations of the same analysis to actually recognize the variability of the matching procedure and resulting dispersion of hazard ratio.

            Comment

            Working...
            X