Announcement

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

  • Synth runner in panel data with multiple different treated units at different time periods

    Hi

    I am looking to use the synth_runner package to construct a synthetic control sample for a data set which includes treated firms which are acquired in a given year (treated firms: acq=1), and untreated firms, which are not acquired (untreated firms: acq=0).

    So the treatment period differs for each treated firm (ie the year of acquisition differs for each firm), but there are overlaps in the main data set.



    Below is a dataex sample of the data:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte id int year byte acq int acqyear byte(post acqpost sic2) int age double(size roa debt)
     1 2003 1 2006 0 0 23  17     75901 .1853731 .4104162
     1 2004 1 2006 0 0 23  18     76838 .0156303 .5749499
     1 2005 1 2006 0 0 23  19     80182 .1124442 .5577187
     1 2006 1 2006 1 1 23  20     75771 .2295601 .2819284
     1 2007 1 2006 1 1 23  21     62282 .1646222 .2521114
     1 2008 1 2006 1 1 23  22     77092 .0258652 .6543221
     1 2009 1 2006 1 1 23  23     51717 .1884487 .2377168
     1 2010 1 2006 1 1 23  24     90815 .0996201 .6718273
     2 2003 0    . . 0 24  22    127058 .0454438 .3140141
     2 2004 0    . . 0 24  23    135544 .0202517 .4588326
     2 2005 0    . . 0 24  24     99803 .0145787 .8432813
     2 2006 0    . . 0 24  25     17924 .1045526 .3339656
     2 2007 0    . . 0 24  26     19024  .108442 .2640349
     2 2008 0    . . 0 24  27     96392 .0564155  .905459
     2 2009 0    . . 0 24  28    140235 .0652405 .3132313
     2 2010 0    . . 0 24  29     17925     .101   .35222
     3 2003 0    . . 0 37  34   8314.93 .0331483 .4884822
     3 2004 0    . . 0 37  35  8076.576 .0407139 .6114611
     3 2005 0    . . 0 37  36  8565.934 .0684565 .5356479
     3 2006 0    . . 0 37  37  6239.243 .0453068 .4800868
     3 2007 0    . . 0 37  38  9442.293 .1006037 .6218933
     3 2008 0    . . 0 37  39 10543.107 .0725632 .6204969
     3 2009 0    . . 0 37  40  9087.624 .0923104 .6302685
     3 2010 0    . . 0 37  41 14039.596 .1068429 .6269325
     4 2003 1 2008 0 0 44  39     11980 .0269616 .7964942
     4 2004 1 2008 0 0 44  40     13108 .0762893 .2413793
     4 2005 1 2008 0 0 44  41     30827 .1728355 .4808772
     4 2006 1 2008 0 0 44  42     11422 .0667134  .486167
     4 2007 1 2008 0 0 44  43     13725 .1268488 .5987614
     4 2008 1 2008 1 1 44  44  4657.897 .1532091  .421163
     4 2009 1 2008 1 1 44  45     11058 .1110508 .3015012
     4 2010 1 2008 1 1 44  46  5538.305 .1192598 .2606857
     5 2003 0    . . 0 32   8     23171 .2823357 .2261879
     5 2004 0    . . 0 32   9     10504 .1088157        .
     5 2005 0    . . 0 32  10     50732 .2026532        .
     5 2006 0    . . 0 32  11     15433 .3511955 .2621007
     5 2007 0    . . 0 32  12     25202 .1146338        .
     5 2008 0    . . 0 32  13     67735  .136414 .5211043
     5 2009 0    . . 0 32  14     79909 .0524221 .6706128
     5 2010 0    . . 0 32  15     98871 .0669256 .4794227
     6 2003 1 2007 0 0 19  22     11716 .2779959 .3218675
     6 2004 1 2007 0 0 19  23     46432 .1514473        .
     6 2005 1 2007 0 0 19  24     86755 .0842833  .209498
     6 2006 1 2007 0 0 19  25     13089 .1424097 .6418366
     6 2007 1 2007 1 1 19  26     79649 .1240694        .
     6 2008 1 2007 1 1 19  27     24922 .1705722 .1119092
     6 2009 1 2007 1 1 19  28     11322 .1696697 .7583466
     6 2010 1 2007 1 1 19  29     69842   .19053        .
     7 2003 0    . . 0 12  17     57704 .2110772 .5504991
     7 2004 0    . . 0 12  18     88898 .2035029 .6685865
     7 2005 0    . . 0 12  19     95042 .2448076 .6113613
     7 2006 0    . . 0 12  20     51367  .216131 .5614694
     7 2007 0    . . 0 12  21     54134 .1617283  .696734
     7 2008 0    . . 0 12  22    103750 .2724434 .6119133
     7 2009 0    . . 0 12  23     51879 .1106228 .6339174
     7 2010 0    . . 0 12  24     45079 .1120921        .
     8 2003 0    . . 0 55 109     24090 .0913657 .3089249
     8 2004 0    . . 0 55 110     53545 .0415165 .3730133
     8 2005 0    . . 0 55 111     24700 .0281781 .2973279
     8 2006 0    . . 0 55 112     65800 .0342249 .4561094
     8 2007 0    . . 0 55 113     42668 .0413893 .2652808
     8 2008 0    . . 0 55 114     45398 .1245429 .4090268
     8 2009 0    . . 0 55 115     23286 .0005153 .2845487
     8 2010 0    . . 0 55 116     64219        . .5183201
     9 2003 0    . . 0 11  77 47774.543 .0375544 .4031637
     9 2004 0    . . 0 11  78 42515.795 .0395456 .4626542
     9 2005 0    . . 0 11  79 52995.306 .0309842 .4276892
     9 2006 0    . . 0 11  80 34509.518 .0238699 .5587063
     9 2007 0    . . 0 11  81 29541.557 .0451881 .4102418
     9 2008 0    . . 0 11  82     30434 .0003943 .5799763
     9 2009 0    . . 0 11  83   29854.4 .0162004  .412549
     9 2010 0    . . 0 11  84     28404  .034643 .5154908
    10 2003 0    . . 0 33  11      8469 .0852521 .3521077
    10 2004 0    . . 0 33  12     11676 .0753683 .2419493
    10 2005 0    . . 0 33  13     10861 .2940797 .2638799
    10 2006 0    . . 0 33  14     10413  .042543 .2503601
    10 2007 0    . . 0 33  15     10946 .0414763  .265211
    10 2008 0    . . 0 33  16     11944 .0620395 .3029136
    10 2009 0    . . 0 33  17     11137  .227889 .2555446
    10 2010 0    . . 0 33  18     10750  .231814 .2872558
    11 2003 0    . . 0 26  59 23597.765 .2280142   .36312
    11 2004 0    . . 0 26  60   14919.5 .0415092 .4155757
    11 2005 0    . . 0 26  61     36228 .0109308 .7736833
    11 2006 0    . . 0 26  62 15040.704 .1399153 .4204167
    11 2007 0    . . 0 26  63  35803.97 .1712919   .19542
    11 2008 0    . . 0 26  64   35015.4 .0017664 .7570628
    11 2009 0    . . 0 26  65 15428.225 .1544364 .3453543
    11 2010 0    . . 0 26  66 14681.708 .0133162 .5495813
    12 2003 0    . . 0 14  55     19218 .0493808 .1590176
    12 2004 0    . . 0 14  56     19382 .0001032 .6363636
    12 2005 0    . . 0 14  57     24843 .0049108 .4855694
    12 2006 0    . . 0 14  58     22438 .0362777  .485783
    12 2007 0    . . 0 14  59     20163 .0614988  .136934
    12 2008 0    . . 0 14  60     16359 .0355767 .5700226
    12 2009 0    . . 0 14  61     22202 .0966129 .6657959
    12 2010 0    . . 0 14  62     17653        . .8522064
    13 2003 0    . . 0 31  44   3527.23 .0373352 .8529379
    13 2004 0    . . 0 31  45  2255.582 .0567157 .6030652
    13 2005 0    . . 0 31  46  3884.253 .0296165 .8362076
    13 2006 0    . . 0 31  47  6509.631 .1099389 .6345384
    end


    Please note however, that there are only 3 treated firms in this small sample, and around 17 untreated firms. The actual data set has several hundred treated firms, and several thousand untreated firms.

    Post is a dummy variable which takes the value 1 after a treated firm is acquired, and acqpost is an interaction between the acq dummy and the post dummy, so acqpost is equal to 1 for treated firms in the treatment period, and 0 otherwise.



    Below is the code I have came up with on the basis of Galiani & Quirstoff (2017) (https://journals.sagepub.com/doi/pdf...7X1801700404):

    Code:
    tsset id year
    
    
    program my_pred, rclass
    1. args tyear
    2. local sic2v "sic2(`=`tyear ́-3 ́(1)`=`tyear ́-1 ́)"
    3. return local predictors "`sic2 ́ age ́ size ́ debt(`=`tyear ́-3 ́(1)`=`tyear ́-1 ́)"
    4. end
    
    
    
    program my_xperiod, rclass
    1. args tyear
    2. return local xperiod "`=`tyear ́-3 ́(1)`=`tyear ́-1 ́"
    3. end
    
    . program my_mspeperiod, rclass
    1. args tyear
    2. return local mspeperiod "`=`tyear ́-3 ́(1)`=`tyear ́-1 ́"
    3. end
    
    
    synth_runner roa sic2 size age debt, d(acqpost) pred_prog(my_pred) trends xperiod_prog(my_xperiod) mspeperiod_prog(my_mspeperiod)
    
    
    effect_graphs


    However, when I run this, I am getting an 'unexpected end of file' error message. I am not sure as to why this is.

    roa is the depvar, the predictor variables are: sic2, age, size, and debt. I tried to use the values of the predictor variables over the 3 years pre-intervention period. (a reminder, the intervention (ie the acquisition year) is different for different treated firms)



    Moreover, I would like to ask whether it is possible to run a difference-in-differences estimation on the treated vs synthetic control samples once the synthetic sample has been identified? (I realise I am not at this stage yet though)


    Any advice on how to progress with these issues would be greatly appreciated,
    Paul
Working...
X