Announcement

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

  • Creating a graph following propensity scores - code not working

    Hello all,

    I've never had a problem with this code, but this time I'm using it on another dataset and it doesn't seem to be generating the results
    AIM: I would like to create a graph showing post-matching results (normally demaracted with a X)
    As you can see the X is missing in my graph

    Click image for larger version

Name:	Screenshot 2023-10-02 at 23.07.51.png
Views:	1
Size:	426.3 KB
ID:	1728857


    Code used:

    Code:
    global treatment volume
    global ylist failure
    global xlist var1 var2 var3
    
    logit $treatment $xlist 
    predict propensity_score
    sum propensity_score
    
    disp .2*0.023 //generates calliper
    
    psmatch2 $treatment $xlist, outcome ($ylist) caliper (0.004) noreplace logit 
    pstest $xlist, treated($treatment) both 
    drop if _weight == . //drops the unmatched
    
    //This creates graph - which doesn't show the matched values.... 
    pstest $xlist, treated($treatment) both graph
    Can you please let me know what I'm doing wrong?


  • #2
    Hi Rose,

    Check the other output from the pstest command, if the Pseudo R squared (Ps R2) in the Unmatched and Matched sample is the same or very similar, it could be that the matched sample is actually overlapping, which is why you can't see it in the graph (x's are directly in front/behind the o's).

    I am getting similar issues when:
    - I use the option mweight() to try to obtain the graph after inverse probability weighting i.e. mweight(ipw_weights)
    - I add the treated() option

    Would be grateful to anyone who can explain why neither of these seem to work!?

    Try running this specification of psmatch2 and see if pstest improves when both of the above options are omitted:
    Code:
    psmatch2 depvar $treatment $xlist, odds logit
    It seems like you were missing the outcome variable (depvar in above) from your psmatch2 code, so that might be part of the problem too...

    I can't guarantee my solutions are correct, I am quite new to this... take with a grain of salt!

    Thanks,
    Hannah
    Last edited by Hannah Beilby; 22 May 2024, 20:45.

    Comment

    Working...
    X