Announcement

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

  • Following teffects nnmatch how do I keep my matched observations?

    I am using Stata version 13.1 and used -teffects nnmatch- to (hopefully) achieve a 3:1 matching. Here's the code I ran:

    teffects nnmatch (outcome race sex age sbp) (treatment), nneighbor(3) generate(match) metric(ivar)

    My output told me:

    Number of obs=121,094
    Matches: requested = 3
    min = 3
    max = 6

    and my dataset has six new variables named match1 thru match6 (I am assuming this but I think each of my cases (where treatment=1) are matched to controls (match1, match2, and match3).

    I have read through the documentation (teffects is brand new to me) but it seems unclear to me how I go about saving a new matched dataset (treatment observations matched to 3 controls)?

    I was planning on running -clogit- and need a group variable to do this. My goal is to find the odds of having outcome=1 given treatment(0 or 1)

    Any help will be greatly appreciated.

  • #2
    I did find a posting regarding teffects psmatch that look similar to what I need: http://www.ssc.wisc.edu/sscc/pubs/stata_psmatch.htm

    The post suggested the following:

    gen ob=_n //store the observation numbers for future use
    save fulldata,replace // save the complete data set

    keep if t // keep just the treated group
    keep match1 // keep just the match1 variable (the observation numbers of their matches)
    bysort match1: gen weight=_N // count how many times each control observation is a match
    by match1: keep if _n==1 // keep just one row per control observation
    ren match1 ob //rename for merging purposes

    merge 1:m ob using fulldata // merge back into the full data
    replace weight=1 if t // set weight to 1 for treated observations

    Except I used match3 thinking that indicated that the control would be matched 3 times however after running merge not match=1,685, from master=547, from using=1,138, and matched=1

    I'm not sure I understand why I didn't get more matched if teffects nnmatch said that:
    Number of obs=121,094
    Matches: requested = 3
    min = 3
    max = 6

    Comment


    • #3
      Dear All,

      Any further help on how to save and analyze the new matched dataset using teffects psmatch?

      https://www.statalist.org/forums/for...using-teffects
      https://www.statalist.org/forums/for...s-were-matched

      Thank you very much for your help

      Comment


      • #4
        Stata keeps all tied matches regardless of what you specify in nneighbor(). If you have multiple control observations which lead to the same distance (very common with discrete data), they will all be kept, which is why you can easily get thousands of matches per observations with particular datasets.

        Comment

        Working...
        X