Announcement

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

  • Averaging matched control observations for dropped treated observations

    Hello,

    I have a dataset with equally many treated (ETS == 1) and control firms (ETS == 0) - each treated has been matched to a control. For the treated observations where more than one good match was found, the treated appears once for each good match.

    Instead of treated firms appearing once for each good match i want it to appear only once, by duplicates drop / collapse, and then average the matched control observations for the dropped duplicates so that there is still equally many treated and control firms.

    For example:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float n str29 bvd_id double(ETS incorporation_year green_pat9903 green_pat0412 morder_treated morder_control)
     1 "CZ15044572" 1 1991 0 0    11 751.5
     2 "CZ15503461" 1 1992 0 0    12 752.5
     3 "CZ15504077" 1 1991 0 0    13 753.5
     4 "CZ16193679" 1 1991 0 0    14 754.5
     5 "CZ16193679" 1 1991 0 0    15 755.5
     6 "CZ16193679" 1 1991 0 0    16 756.5
     7 "CZ49062905" 0 1993 0 0 651.5    11
     8 "CZ60108631" 0 1994 0 0 652.5    12
     9 "CZ25137026" 0 1997 0 0 653.5    13
    10 "CZ11360097" 0 1991 0 0 654.5    14
    11 "CZ12893811" 0 1991 0 0 655.5    15
    12 "CZ13009796" 0 1991 0 0 656.5    16
    end

    bvd_id is the firm identifier, so in the dataex above row 5 and 6 are duplicates of row 4.

    morder_treated and morder_control tells us the matches. If morder_treated == 11 then its match is morder_control == 11 and vice versa. In the example, row 10, 11 and 12 are hence the three matches found for row 4, 5 and 6.

    I can't figure out how to tell stata which control observations that should be averaged.


    Any suggestions would be appreciated!










  • #2
    Instead of treated firms appearing once for each good match i want it to appear only once, by duplicates drop / collapse, and then average the matched control observations for the dropped duplicates so that there is still equally many treated and control firms.
    After reading it a few times, I think I got the first half, but really am lost with the second part. My initial guess is that egen tag may be useful here, but not entirely sure.

    If you can elaborate further using the dataex you showed, it may be easier for users here to help. Try to illustrate by adding the indicator(s) you wanted.

    Comment


    • #3
      Yes, can see it's rather confusing - sorry about that.


      The treatment firm with bvd_id == "CZ16193679" appears three times in the dataex as three different control firms were matched to it. The three matches are the observations that have the same value on morder_control as the treated firm has on morder_treated. So control firm, ETS == 0, with morder_control == 15 is matched to the treatment firm, ETS == 1, with morder_treat == 15 and so on.


      I want each treated firm to appear only once, that is with no duplicates. But if dropping the two duplicated rows of bvd_id == "CZ16193679", there will be more control firms than treated. So in order to have equally many treated and control firms in my sample, i want to collapse(mean) the three matches into one.

      The dataex is prob. a bad example as there is no variation on the three matches except for on morder_*, but nonetheless the dataex i'm looking for would be:

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input float n str29 bvd_id double(ETS incorporation_year morder_treated morder_control)
      1 "CZ16193679" 1 1991    15 755.5
      2 "CZ15503461" 1 1992    12 752.5
      3 "CZ15044572" 1 1991    11 751.5
      4 "CZ15504077" 1 1991    13 753.5
      5 "CZ60108631" 0 1994 652.5    12
      6 "CZ13009796" 0 1991 655.5    15
      7 "CZ25137026" 0 1997 653.5    13
      8 "CZ49062905" 0 1993 651.5    11
      end
      Now bvd_id == "CZ16193679" only appears once, while the three matches for that firm is collapsed into a single row (morder_control == 15).

      I'm unsure of what you mean with 'indicator(s) you wanted'.


      I hope that clarified it a bit, if not please let me know!





      Comment

      Working...
      X