Announcement

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

  • Command for Propensity Score Matching

    I have a group of 237700 patient with 770 of them being the treatment group. I want to apply propensity score matching to choose 770 from the control group matching with the treatment patients. Then I do the post matching analysis for the outcomes. I did the Logistic and the predict pscore commands, but I have problems with the code for the matching

    I would appreciate any help on how to get the right appropriate code.

    Attached the dataex for the sample of my observations. Listed 100 out of 77035 observations. PEG is my treatment



    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float PEG int AGE byte(RACE FEMALE) float(ynel1 ynel6 ynel9 ynel10 ynel11)
    0 61 1 1 1 0 0 0 1
    0 73 1 1 1 0 1 0 1
    0 66 2 0 1 0 0 0 0
    0 41 1 0 1 0 0 1 0
    0 72 1 0 0 0 1 0 1
    0 55 6 1 1 0 1 0 1
    0 72 2 0 0 0 0 0 0
    0 53 3 1 0 0 0 0 0
    0 87 1 0 0 0 1 0 1
    0 54 2 1 1 0 0 0 1
    0 68 1 0 1 0 1 1 0
    0 77 1 1 1 0 0 0 0
    0 69 1 0 1 0 1 1 0
    0 70 1 0 0 0 0 0 0
    0 84 1 0 1 0 0 0 0
    0 52 1 0 0 0 0 0 1
    0 55 1 0 0 0 0 0 0
    0 54 1 1 1 0 0 0 0
    0 81 1 1 0 0 0 0 1
    0 67 1 0 0 0 0 0 0
    0 71 1 1 0 0 0 0 0
    0 64 4 0 0 0 0 0 0
    0 53 1 0 0 0 0 1 0
    0 70 2 1 1 0 0 0 1
    0 42 2 1 0 0 0 0 1
    0 36 1 0 0 1 1 0 0
    0 48 2 1 1 0 0 0 0
    0 72 2 1 0 0 0 1 0
    0 30 1 0 1 0 0 0 0
    0  8 3 0 0 0 0 0 0
    0 34 6 1 0 0 0 0 0
    0 45 3 0 1 0 1 0 0
    0 61 1 0 0 0 0 0 1
    0 53 3 1 0 0 0 0 0
    0 69 1 1 1 0 0 0 1
    0 61 2 1 1 0 1 0 0
    0 48 1 1 0 0 0 0 1
    0 76 6 0 0 0 1 0 1
    0 42 2 1 1 0 0 0 1
    0 36 2 1 0 0 0 0 0
    0 29 3 1 0 0 0 0 0
    0 64 1 0 1 0 0 0 1
    0 71 1 0 1 0 0 0 1
    0 35 1 0 0 0 0 0 1
    0 50 1 0 0 0 0 0 1
    0 40 1 0 0 0 0 0 0
    0 55 1 1 0 0 0 0 0
    0 68 1 0 1 0 0 0 0
    0 75 1 0 0 0 0 0 0
    0 71 1 0 0 0 0 0 1
    0 83 1 0 1 0 0 0 1
    0 82 1 1 0 0 0 0 1
    0 46 1 0 0 0 0 0 1
    0 76 4 0 0 0 0 0 0
    0 58 1 1 0 0 0 0 1
    0 75 1 0 1 0 0 0 0
    0 64 4 0 0 0 0 0 0
    0 84 1 0 1 0 1 0 0
    0 73 4 1 0 0 0 0 0
    0 34 2 1 1 0 0 0 0
    0 50 1 1 0 0 0 0 0
    0 69 1 1 1 0 1 0 0
    0 65 1 1 0 0 0 0 0
    0 51 1 0 1 0 0 0 1
    0 56 3 0 1 0 0 0 1
    0 48 2 1 1 0 0 0 0
    0 77 1 0 1 0 0 0 0
    0 59 2 1 1 0 0 0 1
    0 80 1 1 0 0 0 0 0
    0 69 1 0 1 0 1 0 1
    0 42 6 1 0 0 0 0 0
    0 67 1 1 1 0 0 0 0
    0 69 1 0 0 0 0 0 0
    0 67 1 0 0 0 0 0 1
    0 34 1 1 0 0 0 0 1
    0 29 1 0 1 0 0 0 1
    0 45 1 1 0 0 0 0 1
    0 40 1 0 1 0 0 0 1
    0 66 1 0 1 0 0 0 0
    0 65 1 1 1 0 0 0 1
    0 67 1 1 1 0 0 0 1
    0 60 3 0 0 0 0 0 1
    0 70 2 0 0 0 0 0 1
    0 76 1 0 0 0 0 1 0
    0 70 1 0 0 0 1 0 1
    0 64 1 0 1 0 0 0 0
    0 78 1 1 1 0 0 0 0
    0 41 2 1 0 0 0 0 0
    0  0 1 1 0 0 0 0 0
    0 64 1 0 1 0 0 0 1
    0 32 1 0 0 0 0 0 0
    0 79 4 0 0 0 0 0 1
    0 67 1 1 0 0 0 0 1
    0 28 1 1 0 0 0 0 0
    0 28 1 1 0 0 0 0 0
    0 54 6 0 0 0 0 0 1
    0 56 2 0 0 0 0 0 1
    0  0 1 1 0 0 0 0 0
    0 87 1 0 1 0 0 0 0
    0 63 2 0 0 0 0 0 1
    end
    label values ynel1 ynlab
    label values ynel6 ynlab
    label values ynel9 ynlab
    label values ynel10 ynlab
    label values ynel11 ynlab
    label def ynlab 0 "Absent", modify
    label def ynlab 1 "Present", modify
    label var AGE "Age in years at admission" 
    label var RACE "Race (uniform)" 
    label var FEMALE "Indicator of sex" 
    label var ynel1 "Congestive Heart Failure" 
    label var ynel6 "Hypertension, Uncomplicated" 
    label var ynel9 "Chronic Pulmonary Disease" 
    label var ynel10 "Diabetes, Uncomplicated" 
    label var ynel11 "Diabetes, Complicated"

  • #2
    Maybe:
    Code:
    ssc install kmatch, replace
    kmatch ps PEG control1 control2 control3 (outcomevar), nn(1) wor comsup
    Make sure to study the alternatives of kmatch in detail as this program has so much more to offer. 1:1 matching is outdated, see: https://www.stata.com/meeting/uk17/slides/uk17_Jann.pdf
    Best wishes

    (Stata 16.1 MP)

    Comment


    • #3
      Thank you so much Felix, it was very useful. Now can I do the analysis for the outcome directly? It will be done directly for only the matched patients in the treatment and control? or should I do other commands before starting the analysis?

      I have Stata 17 MP

      Another point: there are 387 missing observations, will this affect the analysis?
      Click image for larger version

Name:	Screenshot 2024-11-20 164015.png
Views:	1
Size:	45.9 KB
ID:	1767971


      Thank you!
      Last edited by Mohamed Eldesouki; 20 Nov 2024, 16:03.

      Comment

      Working...
      X