Announcement

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

  • Difference-in-difference model with continuous treatment levels

    Hi all,

    For my master thesis I have to calculate the effect of CSR investment on various performance measures. The first measure I am considering is Operating Return on Assets (in %). I am following the model that Lins, Servaes and Tamayo (2017) use and reestimate this with a different CSR index and a different time frame. Therefore, I need to estimate a difference-in-difference model with continuous treatment levels. I use quarterly data and estimate the following regression model over the period 2013-2018 (until the second quarter of 2018):

    Performancemeasurei,t = bo + b1CSRi,2016*Crisist + b2CSRi,2016*Pre-Crisist + b3′ Xi,t−1+ Time Dummies + Firm Fixed Effects + ei,t.

    where CSRi,2016 is the measure of CSR computed as of year-end 2016, Crisist is a dummy variable set equal to one for quarters 2017-4, 2018-1 & 2018-2, Pre-Crisist is a dummy variable set to one for quarters in 2013-2016 and 2017-1, 2017-2 & 2017-3, and Xi,t–1 is a vector of control variables. In the models of performance/Operating Return on Assets, I only control for the log of total assets.In the model I include quarter and firm fixed effects and standard errors need to be clustered at firm level. Below I provide an example of my dataset.

    I need to generate an output that looks similar to the one presented in the paper I'm following:


    https://onlinelibrary.wiley.com/doi/...111/jofi.12505

    If I use xtreg opreturnonassets c.csr_negative_3_16##i.crisis CSRcrisis CSRprecrisis lnassets i.fiscal_numeric, fe cluster(id), important variables are omitted because of collinearity
    Could anyone help me with the coding of a difference-in-difference model with continuous treatment levels that results in a similar looking table of outcomes?


    Thank you!

    Julia van Haren



    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str16 TickerSymbol float id int fiscal_numeric float(opreturnonassets opreturnonassets_perc csr_negative_3_16 crisis precrisis CSRcrisis CSRprecrisis lnassets)
    "A" 1 20131 .02159016 2.1590161 .6727601 0 1 0 .6727601 9.273597
    "A" 1 20132 .02625862 2.625862 .6727601 0 1 0 .6727601 9.267382
    "A" 1 20133 .024421094 2.442109 .6727601 0 1 0 .6727601 9.237761
    "A" 1 20134 .028261276 2.8261275 .6727601 0 1 0 .6727601 9.27669
    "A" 1 20141 .01250235 1.250235 .6727601 0 1 0 .6727601 9.272188
    "A" 1 20142 .00943225 .9432251 .6727601 0 1 0 .6727601 9.308011
    "A" 1 20143 .013487476 1.3487476 .6727601 0 1 0 .6727601 9.247636
    "A" 1 20144 .013941464 1.3941464 .6727601 0 1 0 .6727601 9.290168
    "A" 1 20151 .017555526 1.7555525 .6727601 0 1 0 .6727601 8.925188
    "A" 1 20152 .018078791 1.807879 .6727601 0 1 0 .6727601 8.910855
    "A" 1 20153 .02206592 2.2065923 .6727601 0 1 0 .6727601 8.888895
    "A" 1 20154 .02393368 2.393368 .6727601 0 1 0 .6727601 8.919854
    "A" 1 20161 .024102986 2.4102986 .6727601 0 1 0 .6727601 8.895904
    "A" 1 20162 .02015707 2.015707 .6727601 0 1 0 .6727601 8.941153
    "A" 1 20163 .02236876 2.236876 .6727601 0 1 0 .6727601 8.953382
    "A" 1 20164 .02730069 2.730069 .6727601 0 1 0 .6727601 8.962135
    "A" 1 20171 .02820122 2.820122 .6727601 0 1 0 .6727601 8.971067
    "A" 1 20172 .025948104 2.59481 .6727601 0 1 0 .6727601 8.989195
    "A" 1 20173 .02517855 2.517855 .6727601 0 1 0 .6727601 9.0193
    "A" 1 20174 .028839307 2.883931 .6727601 1 0 .6727601 0 9.039078
    "A" 1 20181 .028397333 2.8397334 .6727601 1 0 .6727601 0 9.070848
    "A" 1 20182 .026639344 2.6639345 .6727601 1 0 .6727601 0 9.0806875
    "AA" 2 20131 . . .2994024 . . . . .
    "AA" 2 20141 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20142 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20143 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20144 .06247323 6.247324 .2994024 0 1 0 .2994024 9.835209
    "AA" 2 20151 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20152 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20153 . . .2994024 0 1 0 .2994024 .
    "AA" 2 20154 .0004264912 .04264912 .2994024 0 1 0 .2994024 9.705829
    "AA" 2 20161 -.00006096446 -.006096446 .2994024 0 1 0 .2994024 9.705219
    "AA" 2 20162 .007878344 .7878343 .2994024 0 1 0 .2994024 9.70345
    "AA" 2 20163 .005952037 .5952037 .2994024 0 1 0 .2994024 9.758751
    "AA" 2 20164 .00949764 .9497641 .2994024 0 1 0 .2994024 9.725616
    "AA" 2 20171 .021960646 2.1960645 .2994024 0 1 0 .2994024 9.745429
    "AA" 2 20172 .01783921 1.783921 .2994024 0 1 0 .2994024 9.736783
    "AA" 2 20173 .021907963 2.1907964 .2994024 0 1 0 .2994024 9.755799
    "AA" 2 20174 .03433255 3.433255 .2994024 1 0 .2994024 0 9.766923
    "AA" 2 20181 .025737014 2.5737014 .2994024 1 0 .2994024 0 9.7466
    "AA" 2 20182 .04286233 4.2862334 .2994024 1 0 .2994024 0 9.712206
    "AAC" 3 20131 . . . 0 1 . . .
    "AAC" 3 20132 . . . 0 1 . . .
    "AAC" 3 20133 . . . 0 1 . . .
    "AAC" 3 20134 -.03357505 -3.357505 . 0 1 . . 4.4022946
    "AAC" 3 20141 . . . 0 1 . . .
    "AAC" 3 20142 .021044884 2.1044884 . 0 1 . . 4.540653
    "AAC" 3 20143 .04468333 4.468333 . 0 1 . . 4.626354
    "AAC" 3 20144 .033017706 3.301771 . 0 1 . . 4.983278
    "AAC" 3 20151 .0275792 2.75792 . 0 1 . . 5.241657
    "AAC" 3 20152 .05252895 5.252895 . 0 1 . . 5.348369
    "AAC" 3 20153 .01862769 1.862769 . 0 1 . . 5.673018
    "AAC" 3 20154 -.005277663 -.5277662 . 0 1 . . 5.755897
    "AAC" 3 20161 .007231861 .7231861 . 0 1 . . 5.752557
    "AAC" 3 20162 .0087189395 .8718939 . 0 1 . . 5.892197
    "AAC" 3 20163 -.0034284934 -.3428493 . 0 1 . . 5.941071
    "AAC" 3 20164 -.0020448884 -.20448884 . 0 1 . . 5.95034
    "AAC" 3 20171 .001870799 .1870799 . 0 1 . . 5.982984
    "AAC" 3 20172 .014707943 1.4707943 . 0 1 . . 6.007956
    "AAC" 3 20173 .012192084 1.2192085 . 0 1 . . 6.034442
    "AAC" 3 20174 .01216975 1.216975 . 1 0 . . 6.059765
    "AAC" 3 20181 .01198466 1.198466 . 1 0 . . 6.252701
    "AAC" 3 20182 .00575717 .5757169 . 1 0 . . 6.239792
    "AAL" 4 20131 .00603723 .603723 .27791917 0 1 0 .27791917 10.079623
    "AAL" 4 20132 .02002594 2.002594 .27791917 0 1 0 .27791917 10.174125
    "AAL" 4 20133 .02673637 2.673637 .27791917 0 1 0 .27791917 10.19541
    "AAL" 4 20134 .01300913 1.300913 .27791917 0 1 0 .27791917 10.652022
    "AAL" 4 20141 .01364977 1.364977 .27791917 0 1 0 .27791917 10.68595
    "AAL" 4 20142 .036799 3.6799 .27791917 0 1 0 .27791917 10.71021
    "AAL" 4 20143 .03361782 3.361782 .27791917 0 1 0 .27791917 10.69587
    "AAL" 4 20144 .03065957 3.065957 .27791917 0 1 0 .27791917 10.686727
    "AAL" 4 20151 .032660306 3.2660306 .27791917 0 1 0 .27791917 10.752655
    "AAL" 4 20152 .04334838 4.3348374 .27791917 0 1 0 .27791917 10.776202
    "AAL" 4 20153 .04442164 4.4421635 .27791917 0 1 0 .27791917 10.793742
    "AAL" 4 20154 .03135392 3.135392 .27791917 0 1 0 .27791917 10.787565
    "AAL" 4 20161 .028832475 2.8832474 .27791917 0 1 0 .27791917 10.817957
    "AAL" 4 20162 .03559186 3.559186 .27791917 0 1 0 .27791917 10.84058
    "AAL" 4 20163 .03373249 3.373249 .27791917 0 1 0 .27791917 10.841697
    "AAL" 4 20164 .020029645 2.0029645 .27791917 0 1 0 .27791917 10.84494
    "AAL" 4 20171 .016303418 1.6303418 .27791917 0 1 0 .27791917 10.870985
    "AAL" 4 20172 .033785813 3.378581 .27791917 0 1 0 .27791917 10.884367
    "AAL" 4 20173 .026010955 2.6010954 .27791917 0 1 0 .27791917 10.86668
    "AAL" 4 20174 .01932057 1.932057 .27791917 1 0 .27791917 0 10.847316
    "AAL" 4 20181 .01174925 1.1749249 .27791917 1 0 .27791917 0 10.883316
    "AAL" 4 20182 .02242408 2.242408 .27791917 1 0 .27791917 0 10.87089
    "AAN" 5 20131 .04570513 4.5705132 -.1381169 0 1 0 -.1381169 7.529313
    "AAN" 5 20132 .03309759 3.309759 -.1381169 0 1 0 -.1381169 7.536477
    "AAN" 5 20133 .021146493 2.1146493 -.1381169 0 1 0 -.1381169 7.558768
    "AAN" 5 20134 .01874532 1.874532 -.1381169 0 1 0 -.1381169 7.510527
    "AAN" 5 20141 .03379056 3.379056 -.1381169 0 1 0 -.1381169 7.528993
    "AAN" 5 20142 .01559578 1.559578 -.1381169 0 1 0 -.1381169 7.770429
    "AAN" 5 20143 .015576976 1.5576977 -.1381169 0 1 0 -.1381169 7.735402
    "AAN" 5 20144 .016490668 1.6490668 -.1381169 0 1 0 -.1381169 7.806633
    "AAN" 5 20151 .034662697 3.46627 -.1381169 0 1 0 -.1381169 7.785164
    "AAN" 5 20152 .028801885 2.8801885 -.1381169 0 1 0 -.1381169 7.764172
    "AAN" 5 20153 .01972364 1.9723643 -.1381169 0 1 0 -.1381169 7.756056
    "AAN" 5 20154 .017630389 1.763039 -.1381169 0 1 0 -.1381169 7.885658
    "AAN" 5 20161 .032538872 3.253887 -.1381169 0 1 0 -.1381169 7.843365
    "AAN" 5 20162 .027113294 2.7113295 -.1381169 0 1 0 -.1381169 7.840489
    "AAN" 5 20163 .0217407 2.1740696 -.1381169 0 1 0 -.1381169 7.844394
    end
    [/CODE]
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 49277 observations
    Use the count() option to list more
    Attached Files

  • #2
    The variables CSRcrisis and CSRprecrisis are redundant and are causing the problem. There is a simple colinearity here: csr_negative_3_16 = CSRcrisis + CSRprecrisis. So you cannot have all three of these in the model at the same time. In fact, the term csr_negative_3_16#i.crisis represents exactly the same information as CSRcrisis and CSRprecrisis do. So you can either replace csr_negative_3_16##i.crisis with just i.crisis, or you can drop CSRcrisis and CSRprecrisis from the model. The results will be equivalent and it's just a matter of which way you prefer see the results labeled.

    In any case, the variable csr_negative_3_16 will be omitted because it is colinear with the id fixed effects--but that is normal and expected and is not a problem. In any case, the csr_negative_3_16 coefficient would have no meaning in this model in any case. (If you were thinking it's one of the important variables, think again. It has an important-sounding name, but in fact it represents an unidentifiable parameter and has no bearing on the effects you are actually trying to estimate.)

    Comment


    • #3
      So to be a little more clear about what I am trying to achieve: I want to study the operating performance of companies during the crisis and surrounding periods to explore in more detail possible sources of the excess returns earned by high-CSR firms during the crisis. This is the same regression they do in the previous mentioned paper. Therefore, I need to generate the similar results as I above posted above. Thus, I need a coefficient for the interactive terms CSR*Crisis and CSR*precrisis. And I need the p-value (Crisis-PreCrisis). I understand the redundancy and the colinearity problem. But do you know any way I can come to the results I want to have? I tried both using only CSRcrisis&CSRprecrisis with i.crisis or only c.csr_negative_3_16##i.crisis (see below) but I still miss some of the coefficients I need to get out of this regression. Is there any other way to achieve this?

      Thank you for your help!


      xtreg opreturnonassets CSRcrisis CSRprecrisis lnassets i.fiscal_numeric i.crisis, fe cluster(id)

      Robust
      opreturnonas~s | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      CSRcrisis | .0060749 .0013242 4.59 0.000 .0034781 .0086717
      CSRprecrisis | 0 (omitted)
      lnassets | .0437208 .0098926 4.42 0.000 .0243206 .0631211


      xtreg opreturnonassets c.csr_negative_3_16##i.crisis lnassets i.fiscal_numeric, fe cluster(id)

      Robust
      opreturnonassets | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      csr_negative_3_16 | 0 (omitted)
      1.crisis | -.012989 .0043064 -3.02 0.003 -.0214343 -.0045436
      crisis#c.csr_negative_3_16 |. 0060749 .0013242 4.59 0.000 .0034781 .0086717
      1 |
      lnassets | .0437208 .0098926 4.42 0.000 .0243206 .0631211

      xtreg opreturnonassets c.csr_negative_3_16##i.crisis##i.precrisis lnassets i.fiscal_numeric, fe cluster(id): Also ommits everything except for 1.crisis and crisis#c.csr_negative_3_16

      Comment


      • #4
        The data you have are not usable for the kind of analysis you seek. You will have to go back to your data management and figure out what went wrong.

        The problem is that your variable csr_negative_3_16 is constant within each id: it does not change when the same id goes from pre-crisis to post-crisis. Your variables CSRcrisis and CSRprecrisis are just csr_negative_3_16 multiplied by crisis, so set to 0 after crisis, but equal to crs_negative_3_16 after crisis. In particular, CSRcrisis + CSRprecrisis is always equal to csr_negative_3_16. Consequently, in a fixed effects regression, CSRcrisis and CSRprecrisis will always be jointly colinear with the fixed effects, and so one of them must be dropped. That's linear algebra and there is no way around it. It also means that the effects you are looking to measure are not identifiable from this data.

        I suspect that csr_negative_3_16 is not supposed to be constant within each id: it should differ pre-crisis and post-crisis. Somehow when this data set was created, the same value of csr_negative_3_16 was applied to all observations of each id. If you can find out how that happened and fix it, then I think your regressions will behave as you expect. The problem is definitely in your data.

        Comment

        Working...
        X