Dear Statalist users,
I would like to use a Difference in Difference model. My data involves panel data, firm-level analysis over the period 2012-2017.
I am relatively new to Stata and therefore I would like to ask for some help with how to do a regression using the dif-in-dif model.
I would like to measure the effect of the use of assurance services on financial performance. Financial performance in this case is measured as return on assets ("roa").
Control variables are firm size (measures by total assets) and industry (measures by GIC industries "gind").
My treatment is the use of third party assurance services. I made a dummy variable which is 1 for a firm that uses assurance services and 0 for a firm that doesn't.
I also made two variables 'firmid' and 'timeid'.
The tricky thing about my data is that the treatment moments differ for each firm. E.g. some firms might not be treated until 2015 and then are treated after 2015. Another firm might be treated in the years 2012 and 2013, but treatment stopped in the following years. And then there are firms that are not treated in for instance 2012, 2013 and 2014, then are treated only in 2015, and not treated again in 2016 and 2017.
The research design that I have come up with is as follows:
𝑌𝑖𝑡=𝛼0+𝛼1𝐴𝑠𝑠𝑢𝑟𝑎𝑛𝑐𝑒𝑖𝑡+𝛽𝑋𝑖𝑡+𝑢𝑖+𝑑𝑡+𝜀𝑖𝑡
where
Y=roa
The coefficient on Assurance, 𝛼1, is the variation in the dependent variable Y caused by differences between the treated and the control group in the period t when the assurance is used.
X= the vector of controls
𝑢𝑖= the fixed variation effect caused by external control industry
𝑑𝑡=the fixed variation effect caused by year specific changes
I hope I am clear enough in my explanation of what I need. See example of data below.
kind regards, Fleur
I would like to use a Difference in Difference model. My data involves panel data, firm-level analysis over the period 2012-2017.
I am relatively new to Stata and therefore I would like to ask for some help with how to do a regression using the dif-in-dif model.
I would like to measure the effect of the use of assurance services on financial performance. Financial performance in this case is measured as return on assets ("roa").
Control variables are firm size (measures by total assets) and industry (measures by GIC industries "gind").
My treatment is the use of third party assurance services. I made a dummy variable which is 1 for a firm that uses assurance services and 0 for a firm that doesn't.
I also made two variables 'firmid' and 'timeid'.
The tricky thing about my data is that the treatment moments differ for each firm. E.g. some firms might not be treated until 2015 and then are treated after 2015. Another firm might be treated in the years 2012 and 2013, but treatment stopped in the following years. And then there are firms that are not treated in for instance 2012, 2013 and 2014, then are treated only in 2015, and not treated again in 2016 and 2017.
The research design that I have come up with is as follows:
𝑌𝑖𝑡=𝛼0+𝛼1𝐴𝑠𝑠𝑢𝑟𝑎𝑛𝑐𝑒𝑖𝑡+𝛽𝑋𝑖𝑡+𝑢𝑖+𝑑𝑡+𝜀𝑖𝑡
where
Y=roa
The coefficient on Assurance, 𝛼1, is the variation in the dependent variable Y caused by differences between the treated and the control group in the period t when the assurance is used.
X= the vector of controls
𝑢𝑖= the fixed variation effect caused by external control industry
𝑑𝑡=the fixed variation effect caused by year specific changes
I hope I am clear enough in my explanation of what I need. See example of data below.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str34 nameyear str3 ExternalAssurance float(roa ExternalAssurancedum firmsize) str6 gind "REXAM2012" "No" .033631936 0 6363 "151030" "REXAM2015" "Yes" .03750258 1 4853 "151030" "BP2012" "Yes" .03857518 1 300193 "101020" "BP2013" "Yes" .07670843 1 305690 "101020" "BP2014" "Yes" .013288545 1 284305 "101020" "BP2015" "Yes" -.02476397 1 261832 "101020" "BP2016" "Yes" .0004329399 1 263316 "101020" "BP2017" "Yes" .0122525 1 276515 "101020" "GLAXOSMITHKLINE2012" "Yes" .1100663 1 41475 "352020" "GLAXOSMITHKLINE2013" "Yes" .1291641 1 42086 "352020" "GLAXOSMITHKLINE2014" "Yes" .06779661 1 40651 "352020" "GLAXOSMITHKLINE2015" "No" .1575796 0 53446 "352020" "GLAXOSMITHKLINE2016" "No" .015436435 0 59081 "352020" "GLAXOSMITHKLINE2017" "No" .027172275 0 56381 "352020" "UNILEVER2012" "No" .09704112 0 46166 "303020" "UNILEVER2013" "No" .10638718 0 45513 "303020" "UNILEVER2014" "No" .1076686 0 48027 "303020" "UNILEVER2015" "Yes" .09386592 1 52298 "303020" "UNILEVER2016" "Yes" .09186766 1 56429 "303020" "UNILEVER2017" "Yes" .1004064 1 60285 "303020" "BARCLAYS2012" "Yes" -.0006985072 1 1490321 "401010" "BARCLAYS2013" "Yes" .0004115016 1 1312267 "401010" "BARCLAYS2014" "Yes" -.00008837136 1 1357906 "401010" "BARCLAYS2015" "Yes" -.00028928262 1 1120012 "401010" "BARCLAYS2016" "No" .0012875827 0 1213126 "401010" "BARCLAYS2017" "Yes" .0005179802 1 1133248 "401010" "THALES2012" "No" .025112037 0 21332.4 "201010" "THALES2013" "No" .02667622 0 21494.8 "201010" "THALES2014" "Yes" .035726614 1 19990.7 "201010" "THALES2015" "No" .035486683 0 21560.2 "201010" "THALES2016" "No" .04171074 0 22689.6 "201010" "THALES2017" "No" .035217576 0 23332.1 "201010" "VODAFONE GRP2013" "No" .09148063 0 121840 "501020" "VODAFONE GRP2014" "Yes" .04653553 1 122573 "501020" "VODAFONE GRP2015" "Yes" -.030094307 1 133713 "501020" "VODAFONE GRP2016" "Yes" -.014157896 1 154684 "501020" end
Comment