Announcement

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

  • Ensuring treated cases are only matched to control cases (and not treated to treated) in staggered treatment sample

    Hello,

    I am using psmatch2 to match a set of treated firms on a one-to-one basis to a set of control firms, without replacement. I have 240 treated firms, 2000 potential control firms, data from 2000-2012 on each firm, and staggered treatments (firms are treated in only one year sometime between 2000 and 2012). I have used a logit model to compute an inclusion score (based on size and firm profitability) on which I am matching. I want to end up with 480 firms (240 treated and 240 control).

    My problem: I am finding treated firms are being matched to other treated firms. For instance, if a firm is treated in 2004, it may be matched to another firm that was treated in 2012 (because these 2 firms were the best match in 2004).

    DATA:
    I have 3 variables indicating treatment:

    treat_firm is binary: 1 = treated firm; 0 = control (at any year in the sample)
    treat_obs is binary: 1 = after treatment; 0 = otherwise
    treat_yr is binary: 1 = year of treatment; 0 = otherwise

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(treat_firm treat_obs treat_yr id) int date float timeperiod double _pscore
    0 0 0   10 2002  .                   .
    0 0 0   10 2003  .                   .
    0 0 0   10 2004  .                   .
    0 0 0   10 2005  . .007831839844584465
    0 0 0   10 2006  . .031004680320620537
    0 0 0   10 2007  .  .03598975017666817
    0 0 0   10 2008  . .055476751178503036
    0 0 0   10 2009  .  .06663750112056732
    0 0 0   10 2010  .   .0748022198677063
    0 0 0   10 2011  .  .07143108546733856
    0 0 0   10 2012  .  .07664291560649872
    0 0 0   10 2013  .  .07611804455518723
    0 0 0   10 2014  .  .08269821852445602
    0 0 0   10 2015  .  .08018551021814346
    0 0 0   10 2016  .  .05369822308421135
    1 0 0   15 2002 -3                   .
    1 0 0   15 2003 -2 .002403931226581335
    1 0 0   15 2004 -1 .002281791530549526
    1 0 1   15 2005  0 .005196270067244768
    1 1 0   15 2006  1  .02427402138710022
    1 1 0   15 2007  2  .02381252497434616
    1 1 0   15 2008  3  .05723017081618309
    1 1 0   15 2009  4  .06792044639587402
    1 1 0   15 2010  5  .07723898440599442
    1 1 0   15 2011  6  .07237258553504944
    1 1 0   15 2012  7  .07515228539705277
    1 1 0   15 2013  8  .07898689806461334
    1 1 0   15 2014  9  .07588952034711838
    1 1 0   15 2015 10  .07458687573671341
    1 1 0   15 2016 11  .06634620577096939
    1 0 0 4717 2002 -8                   .
    1 0 0 4717 2003 -7                   .
    1 0 0 4717 2004 -6                   .
    1 0 0 4717 2005 -5                   .
    1 0 0 4717 2006 -4                   .
    1 0 0 4717 2007 -3                   .
    1 0 0 4717 2008 -2 .014903109520673752
    1 0 0 4717 2009 -1 .014658588916063309
    1 0 1 4717 2010  0  .01327584870159626
    1 1 0 4717 2011  1 .020055023953318596
    1 1 0 4717 2012  2 .023409312590956688
    1 1 0 4717 2013  3   .7394242882728577
    1 1 0 4717 2014  4 .026425572112202644
    1 1 0 4717 2015  5 .021240347996354103
    1 1 0 4717 2016  6                   .
    0 0 0 4722 2002  .                   .
    0 0 0 4722 2003  .  .10610748082399368
    0 0 0 4722 2004  .                   .
    0 0 0 4722 2005  .                   .
    0 0 0 4722 2006  .                   .
    0 0 0 4722 2007  .  .03600063920021057
    0 0 0 4722 2008  .  .11515945196151733
    0 0 0 4722 2009  .  .10610748082399368
    0 0 0 4722 2010  .  .11510999500751495
    0 0 0 4722 2011  .  .10206738114356995
    0 0 0 4722 2012  .                   .
    0 0 0 4722 2013  .   .1194879561662674
    0 0 0 4722 2014  .  .11255602538585663
    0 0 0 4722 2015  .   .1092936098575592
    0 0 0 4722 2016  .   .0961095318198204
    end


    CODE:
    My code for one to one matching (based on inclusion score calculated earlier using logit model). I am guessing I need some condition added to the loop to ensure treated firms are not matched to one another. I just don't know where this goes or what it should be.

    Code:
    foreach l of local levels {
            psmatch2 treat_yr, pscore(Inclusion_Score) neighbor(1) noreplacement, if grouping == `l' 
                replace n1 = _n1 if grouping == `l'
                replace Industry_id = _id if grouping == `l'
                replace pdif = _pdif if grouping == `l'     
                replace support = _support if grouping == `l'
                replace treated = _treated if grouping == `l'
                replace weight = _weight if grouping == `l'
                replace nn = _nn if grouping == `l'
            }
            
            drop _n1
            drop _id
            drop _pdif
            drop _treated
            drop _support
            drop _weight
            drop _nn


    This has been boggling my mind for some time now, so thank you in advance for your help. If you need more code (e.g., on the inclusion score) then please let me know. Thanks!

    RC

  • #2
    This is an uneducated guess - I am not a user of psmatch2 - based on reading help psmatch2 which says

    Treatment status is identified by depvar==1 for the treated and depvar==0 for the untreated observations.
    So I wonder if
    Code:
    replace treat_year = . if treat_firm==1 & treat_year==0
    prior to the psmatch2 would have the effect of excluding all observations from treated firms except for the single observation which is to be matched.

    Perhaps a better approach would be
    Code:
    psmatch2 treat_yr if ! (treat_firm==1 & treat_year==0), ...
    would explicitly all observations from treated firms except for the single observation which is to be matched.

    Comment


    • #3
      Thanks for the help William. The first code worked wonderfully; I just added a second line after the matching code to re-fill the treat_yr variable with the zeroes (for analysis purposes). I couldn't figure out the second approach, working the restriction criterion right into the psmatch2.

      I appreciate your help!

      Comment

      Working...
      X