Hello everybody
For my master's dissertation, I am doing a research about a certain type of loan SME's can get and wether or not this loan gives a difference in solvency rate (in this dataset defined as 'EQTotAss') in comparison to SME's who chose other types of financing. For this, I need to do a DID regression in Stata 17 with the xtdidregress command. My data, of which you find an extract below, can be considered as longitudinal panel data. My 'treated' group are all companies who got that particular type of loan in 2016, and their financial data from 2014-2019. The control group are other SME's who were matched to the treated group with the psmatch2 command (which explains the '_weight' in the dataset, made it easier to drop non-matched ID's afterwards too), with 3 nearest neighbors for every treated ID. From those, I also have the yearly financial data from 2014-2019.
I'll admit beforehand, my experience with Stata was nonexisting and the PSM only worked thanks to this forum. Now, with this remaining set of companies, I need to do an xtdidregress command to see what the 'EQTotAss' difference is between treated and control. Firstly, I converted the dataset to panel data by doing
So far so good. Then, I wanted to do the actual Difference in Differences this way:
Where EQTotAss is of course my variable of interest, Treat is a binary variable indicating treatment (=1) or control (=0) group, NACEVALUE groups the ID's in different sectors according to European NACE classification; this is the 'Naceclass' where every letter corresponds to a number. Year of course says what year it is, where 2014-2015 is pre-treatment and 2016-2019 is post-treatment. What am I doing wrong here, how can I group the ID's to make this work? I've tried dividing them in three new groups according to _weight. This because some controls have been matched to multiple treated ID's, which gave them different _weight and made it easy to divide into 3 groups. Problem was then Treat of course gets omitted because of collinearity with _weight==1.
I feel I'm overlooking something very obvious, but my days of searching didn't give any response so far. I've tried comparing with the 'hospitals' DiD example Stata includes, but the dataset isn't really comparable to mine. Any response in the right direction would be immensely helpful, thanks in advance!
For my master's dissertation, I am doing a research about a certain type of loan SME's can get and wether or not this loan gives a difference in solvency rate (in this dataset defined as 'EQTotAss') in comparison to SME's who chose other types of financing. For this, I need to do a DID regression in Stata 17 with the xtdidregress command. My data, of which you find an extract below, can be considered as longitudinal panel data. My 'treated' group are all companies who got that particular type of loan in 2016, and their financial data from 2014-2019. The control group are other SME's who were matched to the treated group with the psmatch2 command (which explains the '_weight' in the dataset, made it easier to drop non-matched ID's afterwards too), with 3 nearest neighbors for every treated ID. From those, I also have the yearly financial data from 2014-2019.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long ID str1 Naceclass int(Year InstYear) double EQTotAss byte(Treat Post) double _weight byte NACEVALUE 1 "G" 2014 1947 32.6406014702109 1 0 1 4 1 "G" 2015 1947 33.8920049743329 1 0 1 4 1 "G" 2016 1947 28.2327031474589 1 1 1 4 1 "G" 2017 1947 14.8924649002703 1 1 1 4 1 "G" 2018 1947 -9.87200666407716 1 1 1 4 1 "G" 2019 1947 -43.9982995098913 1 1 1 4 2 "G" 2014 1967 12.6942951466242 1 0 1 4 2 "G" 2015 1967 19.0794423228928 1 0 1 4 2 "G" 2016 1967 24.7809215661874 1 1 1 4 2 "G" 2017 1967 26.9791549680904 1 1 1 4 2 "G" 2018 1967 24.0291518840078 1 1 1 4 2 "G" 2019 1967 26.1678007797327 1 1 1 4 3 "N" 2014 1972 23.3552878594458 1 0 1 11 3 "N" 2015 1972 15.920110911838 1 0 1 11 3 "N" 2016 1972 9.40103436228268 1 1 1 11 3 "N" 2017 1972 11.6781888375917 1 1 1 11 3 "N" 2018 1972 15.9009691916184 1 1 1 11 3 "N" 2019 1972 15.1472736871831 1 1 1 11 4 "G" 2014 1974 20.6236539985521 1 0 1 4 4 "G" 2015 1974 21.7696006916302 1 0 1 4 4 "G" 2016 1974 17.4387218397215 1 1 1 4 4 "G" 2017 1974 13.9735025667395 1 1 1 4 4 "G" 2018 1974 12.5120257648545 1 1 1 4 4 "G" 2019 1974 13.9218818223522 1 1 1 4 5 "F" 2014 1976 45.9746975970946 1 0 1 3 5 "F" 2015 1976 46.5163785796174 1 0 1 3 5 "F" 2016 1976 48.6401965669444 1 1 1 3 5 "F" 2017 1976 50.5212689718457 1 1 1 3 5 "F" 2018 1976 39.8157249306825 1 1 1 3 5 "F" 2019 1976 40.3284662251476 1 1 1 3 6 "G" 2014 1981 55.7029418131835 1 0 1 4 6 "G" 2015 1981 46.6763269195715 1 0 1 4 6 "G" 2016 1981 50.8085941886075 1 1 1 4 6 "G" 2017 1981 51.2017406491572 1 1 1 4 6 "G" 2018 1981 54.0528553637935 1 1 1 4 6 "G" 2019 1981 60.0368099213494 1 1 1 4 7 "N" 2014 1982 12.412772256291 1 0 1 11 7 "N" 2015 1982 25.8026389306743 1 0 1 11 7 "N" 2016 1982 33.2674527669838 1 1 1 11 7 "N" 2017 1982 16.3593316031508 1 1 1 11 7 "N" 2018 1982 -69.9660602014132 1 1 1 11 7 "N" 2019 1982 -17.7309842126474 1 1 1 11 8 "G" 2014 1983 12.551288364862 1 0 1 4 8 "G" 2015 1983 13.6327614424031 1 0 1 4 8 "G" 2016 1983 14.4829319000867 1 1 1 4 8 "G" 2017 1983 13.9116920401375 1 1 1 4 8 "G" 2018 1983 11.5376267977135 1 1 1 4 8 "G" 2019 1983 11.2173435098684 1 1 1 4 9 "G" 2014 1983 41.2645473165449 1 0 1 4 9 "G" 2015 1983 45.9550992397708 1 0 1 4 9 "G" 2016 1983 41.8151126492942 1 1 1 4 9 "G" 2017 1983 45.4197580531984 1 1 1 4 9 "G" 2018 1983 45.5840512923262 1 1 1 4 9 "G" 2019 1983 42.309229324435 1 1 1 4 10 "K" 2014 1983 90.3568817704526 1 0 1 8 10 "K" 2015 1983 43.352756611385 1 0 1 8 10 "K" 2016 1983 8.47506437186611 1 1 1 8 10 "K" 2017 1983 38.096260127703 1 1 1 8 10 "K" 2018 1983 21.3626810838561 1 1 1 8 10 "K" 2019 1983 32.6933890272311 1 1 1 8 11 "A" 2014 1984 9.76597818789505 1 0 1 1 11 "A" 2015 1984 10.4242072296313 1 0 1 1 11 "A" 2016 1984 9.21042939552771 1 1 1 1 11 "A" 2017 1984 11.2687789698305 1 1 1 1 11 "A" 2018 1984 14.9450847863529 1 1 1 1 11 "A" 2019 1984 17.5874947986905 1 1 1 1 12 "G" 2014 1984 23.3139955909947 1 0 1 4 12 "G" 2015 1984 18.4794890752551 1 0 1 4 12 "G" 2016 1984 15.9237637257454 1 1 1 4 12 "G" 2017 1984 12.0237062947727 1 1 1 4 12 "G" 2018 1984 10.3764739883332 1 1 1 4 12 "G" 2019 1984 5.52145020594037 1 1 1 4 13 "G" 2014 1984 77.315176580457 1 0 1 4 13 "G" 2015 1984 62.1478303981376 1 0 1 4 13 "G" 2016 1984 11.1298090872164 1 1 1 4 13 "G" 2017 1984 15.2496512780868 1 1 1 4 13 "G" 2018 1984 7.86969724855066 1 1 1 4 13 "G" 2019 1984 17.1587698103935 1 1 1 4 14 "G" 2014 1984 17.0968226814307 1 0 1 4 14 "G" 2015 1984 -15.5914219086402 1 0 1 4 14 "G" 2016 1984 -5.80762836817773 1 1 1 4 14 "G" 2017 1984 14.2140058002349 1 1 1 4 14 "G" 2018 1984 15.9713308982548 1 1 1 4 14 "G" 2019 1984 5.64779131465342 1 1 1 4 15 "F" 2014 1984 12.9673074012411 1 0 1 3 15 "F" 2015 1984 10.2540354591162 1 0 1 3 15 "F" 2016 1984 12.6596863163049 1 1 1 3 15 "F" 2017 1984 13.4509490263636 1 1 1 3 15 "F" 2018 1984 25.3390481064483 1 1 1 3 15 "F" 2019 1984 52.2303217730653 1 1 1 3 16 "G" 2014 1985 14.4541847445055 1 0 1 4 16 "G" 2015 1985 19.6117854618801 1 0 1 4 16 "G" 2016 1985 24.3806311396129 1 1 1 4 16 "G" 2017 1985 26.0357442075035 1 1 1 4 16 "G" 2018 1985 23.5179712829521 1 1 1 4 16 "G" 2019 1985 29.9285870826546 1 1 1 4 17 "G" 2014 1985 -1.19360704224253 1 0 1 4 17 "G" 2015 1985 12.4497488713605 1 0 1 4 17 "G" 2016 1985 17.3333444631797 1 1 1 4 17 "G" 2017 1985 14.4851065968165 1 1 1 4 end
I'll admit beforehand, my experience with Stata was nonexisting and the PSM only worked thanks to this forum. Now, with this remaining set of companies, I need to do an xtdidregress command to see what the 'EQTotAss' difference is between treated and control. Firstly, I converted the dataset to panel data by doing
Code:
. xtset ID Year Panel variable: ID (strongly balanced) Time variable: Year, 2014 to 2019 Delta: 1 unit
Code:
. xtdidregress (EQTotAss) (Treat), group (NACEVALUE) time(Year) invalid group specification None of the groups defined by NACEVALUE is a control. r(198);
I feel I'm overlooking something very obvious, but my days of searching didn't give any response so far. I've tried comparing with the 'hospitals' DiD example Stata includes, but the dataset isn't really comparable to mine. Any response in the right direction would be immensely helpful, thanks in advance!
Comment