Announcement

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

  • Can someone please help me validate whether my panel DiD Stata codes are correct?

    Hello,

    I am currently in the midst of analyzing the impact of an occupational deregulation policy in the United States on job mobility within the health industry. In other words, the research question is "does this policy lead to to higher job outflows/job mobility among health workers from a given state that adopted this policy?"

    8 states were identified as the treatment cohort, while 12 states act as the controls. The treatment date varies across states. My job-to-job flows data is multidimensional, with a breakdown of industry, origin state and destination state (i.e. a worker in the manufacturing industry moved from Wyoming to Nebraska). The data is quarterly, from 2000Q2 to 2016Q1. I am adopting a difference-in-differences approach.

    After what seemed like a long time, my data set has been structured correctly and is finally in proper panel data format. My question now is whether my Stata codes are correct for what I am trying to achieve. My identifiers are geography_orig, geography, and industry, whereby geography_orig = origin state and geography = destination state. My time identifier is quarterly date (qdate). First question, can there be three unique identifiers as in my case?

    Code:
    egen id = group(geography_orig geography industry)
    Code:
    xtset id qdate
    I have already generated my time-varying treatment variable, treat_post. Now I want to run my DiD model, including dummies as controls (this way the dummies are absorbing the effects particular to each state, industry and quarter, leaving me with a more "pure" effect of the policy) and I want to cluster my standard errors at the state and year levels as I think observations from state and year correlate. This leads me to:

    Code:
    egen state_year = group(geography_orig year)
    Code:
    reg logj2j treat_post i.geography_orig i.industry i.qdate, vce(cluster state_year)
    Note: logj2j=log of job outflows

    My second question is, are these Stata codes flawed?

    Your help would be highly appreciated. Thank you.

    Best,
    Amy


  • #2
    Depending on what your treat_post variable actually is, this might be a way to approach your research question. But it is not a difference-in-differences model. For that you need two separate variables: treatment_group, and pre_post, along with their interaction.

    So treatment_group should be 1, at all times, for any state that adopted the policy at some point, and 0, at all times, for any state that never adopted policy.

    The pre_post variable is hard when there is not a single start of policy date. For the states in the treatment group, it is easy: it is 0 before the policy onset date and 1 thereafter. For the states on the non-policy (treatment_group = 0) group, this is complicated. For these states you need to identify a "date they would have adopted the policy if they had adopted it." There might be a real basis for this: the legislature considered it on a certain date and voted it down. Or there might not. If there is no real basis for this, you should match these states to the treatment_group = 1 states on the most relevant variables you have and then impute the threshold time between pre- and post- from the closest matched policy state.

    Once you have those, then it's

    Code:
    reg logj2j i.treatment_group##i.pre_post i.geography_orig i.industry i.qdate, vce(cluster state_year)
    Note that when you run this, in addition to losing the reference level for i.geography_orig and i.qdate, you will lose one more of each of those due to their colinearity with treatment_group and pre_post, respectively. That is not a problem and you shouldn't waste a second worrying about it. The diff-in-diff estimator of the policy effect will be the coefficient of the 1.treatment_group#1.pre_post interaction term.

    You will probably also want to look at the expected logj2j values in each group, both before and after, and the marginal effect of the transition to post-policy era in both groups:

    Code:
    margins treatment_group#pre_post
    margins treatment_group, dydx(pre_post)

    Comment


    • #3
      Dear Clyde,

      Thank you for the helpful reply. Allow me to provide more clarity on my treat_post variable. It is essentially a dummy variable that equals 1 in state 's' after the policy has been implemented at quarter 'q'. This dummy varies across time based on when the treatment states implemented the policy. Below are the Stata codes to illustrate what I did.

      *Generate dummy variable for states adopting the policy, health industry and jobs going to states that have also adopted the policy
      Code:
      gen treat=0
      replace treat=1 if (geography_orig==31 & industry==62 & geography==24) | (geography_orig==31 & industry==62 & geography==48) | (geography_orig==31 & industry==62 & geography==49) |(geography_orig==31 & industry==62 & geography==55) | (geography_orig==31 & industry==62 & geography==5) | (geography_orig==31 & industry==62 & geography==10) | (geography_orig==31 & industry==62 & geography==16) | (geography_orig==31 & industry==62 & geography==19) | (geography_orig==31 & industry==62 & geography==37) | (geography_orig==31 & industry==62 & geography==46)
      replace treat=1 if (geography_orig==46 & industry==62 & geography==24) | (geography_orig==46 & industry==62 & geography==48) | (geography_orig==46 & industry==62 & geography==49) |(geography_orig==46 & industry==62 & geography==55) | (geography_orig==46 & industry==62 & geography==5) | (geography_orig==46 & industry==62 & geography==10) | (geography_orig==46 & industry==62 & geography==16) | (geography_orig==46 & industry==62 & geography==19) | (geography_orig==46 & industry==62 & geography==37) | (geography_orig==46 & industry==62 & geography==31)
      replace treat=1 if (geography_orig==47 & industry==62 & geography==24) | (geography_orig==47 & industry==62 & geography==48) | (geography_orig==47 & industry==62 & geography==49) |(geography_orig==47 & industry==62 & geography==55) | (geography_orig==47 & industry==62 & geography==5) | (geography_orig==47 & industry==62 & geography==10) | (geography_orig==47 & industry==62 & geography==16) | (geography_orig==47 & industry==62 & geography==19) | (geography_orig==47 & industry==62 & geography==37) | (geography_orig==47 & industry==62 & geography==31) | (geography_orig==47 & industry==62 & geography==46) | (geography_orig==47 & industry==62 & geography==28) | (geography_orig==47 & industry==62 & geography==23) | (geography_orig==47 & industry==62 & geography==4)
      replace treat=1 if (geography_orig==38 & industry==62 & geography==24) | (geography_orig==38 & industry==62 & geography==48) | (geography_orig==38 & industry==62 & geography==49) |(geography_orig==38 & industry==62 & geography==55) | (geography_orig==38 & industry==62 & geography==5) | (geography_orig==38 & industry==62 & geography==10) | (geography_orig==38 & industry==62 & geography==16) | (geography_orig==38 & industry==62 & geography==19) | (geography_orig==38 & industry==62 & geography==37) | (geography_orig==38 & industry==62 & geography==31) | (geography_orig==38 & industry==62 & geography==46) | (geography_orig==38 & industry==62 & geography==28) | (geography_orig==38 & industry==62 & geography==23) | (geography_orig==38 & industry==62 & geography==4) | (geography_orig==38 & industry==62 & geography==47) | (geography_orig==38 & industry==62 & geography==35)
      replace treat=1 if (geography_orig==45 & industry==62 & geography==24) | (geography_orig==45 & industry==62 & geography==48) | (geography_orig==45 & industry==62 & geography==49) |(geography_orig==45 & industry==62 & geography==55) | (geography_orig==45 & industry==62 & geography==5) | (geography_orig==45 & industry==62 & geography==10) | (geography_orig==45 & industry==62 & geography==16) | (geography_orig==45 & industry==62 & geography==19) | (geography_orig==45 & industry==62 & geography==37) | (geography_orig==45 & industry==62 & geography==31) | (geography_orig==45 & industry==62 & geography==46) | (geography_orig==45 & industry==62 & geography==28) | (geography_orig==45 & industry==62 & geography==23) | (geography_orig==45 & industry==62 & geography==4) | (geography_orig==45 & industry==62 & geography==47) | (geography_orig==45 & industry==62 & geography==35) | (geography_orig==45 & industry==62 & geography==35) | (geography_orig==45 & industry==62 & geography==38) | (geography_orig==45 & industry==62 & geography==51) | (geography_orig==45 & industry==62 & geography==33)
      replace treat=1 if (geography_orig==21 & industry==62 & geography==24) | (geography_orig==21 & industry==62 & geography==48) | (geography_orig==21 & industry==62 & geography==49) |(geography_orig==21 & industry==62 & geography==55) | (geography_orig==21 & industry==62 & geography==5) | (geography_orig==21 & industry==62 & geography==10) | (geography_orig==21 & industry==62 & geography==16) | (geography_orig==21 & industry==62 & geography==19) | (geography_orig==21 & industry==62 & geography==37) | (geography_orig==21 & industry==62 & geography==31) | (geography_orig==21 & industry==62 & geography==46) | (geography_orig==21 & industry==62 & geography==28) | (geography_orig==21 & industry==62 & geography==23) | (geography_orig==21 & industry==62 & geography==4) | (geography_orig==21 & industry==62 & geography==47) | (geography_orig==21 & industry==62 & geography==35) | (geography_orig==21 & industry==62 & geography==38) | (geography_orig==21 & industry==62 & geography==51) | (geography_orig==21 & industry==62 & geography==33) | (geography_orig==21 & industry==62 & geography==45)
      replace treat=1 if (geography_orig==8 & industry==62 & geography==24) | (geography_orig==8 & industry==62 & geography==48) | (geography_orig==8 & industry==62 & geography==49) |(geography_orig==8 & industry==62 & geography==55) | (geography_orig==8 & industry==62 & geography==5) | (geography_orig==8 & industry==62 & geography==10) | (geography_orig==8 & industry==62 & geography==16) | (geography_orig==8 & industry==62 & geography==19) | (geography_orig==8 & industry==62 & geography==37) | (geography_orig==8 & industry==62 & geography==31) | (geography_orig==8 & industry==62 & geography==46) | (geography_orig==8 & industry==62 & geography==28) | (geography_orig==8 & industry==62 & geography==23) | (geography_orig==8 & industry==62 & geography==4) | (geography_orig==8 & industry==62 & geography==47) | (geography_orig==8 & industry==62 & geography==35) | (geography_orig==8 & industry==62 & geography==38) | (geography_orig==8 & industry==62 & geography==51) | (geography_orig==8 & industry==62 & geography==33) | (geography_orig==8 & industry==62 & geography==45) | (geography_orig==8 & industry==62 & geography==21)
      replace treat=1 if (geography_orig==29 & industry==62 & geography==24) | (geography_orig==29 & industry==62 & geography==48) | (geography_orig==29 & industry==62 & geography==49) |(geography_orig==29 & industry==62 & geography==55) | (geography_orig==29 & industry==62 & geography==5) | (geography_orig==29 & industry==62 & geography==10) | (geography_orig==29 & industry==62 & geography==16) | (geography_orig==29 & industry==62 & geography==19) | (geography_orig==29 & industry==62 & geography==37) | (geography_orig==29 & industry==62 & geography==31) | (geography_orig==29 & industry==62 & geography==46) | (geography_orig==29 & industry==62 & geography==28) | (geography_orig==29 & industry==62 & geography==23) | (geography_orig==29 & industry==62 & geography==4) | (geography_orig==29 & industry==62 & geography==47) | (geography_orig==29 & industry==62 & geography==35) | (geography_orig==29 & industry==62 & geography==38) | (geography_orig==29 & industry==62 & geography==51) | (geography_orig==29 & industry==62 & geography==33) | (geography_orig==29 & industry==62 & geography==45) | (geography_orig==29 & industry==62 & geography==21) | (geography_orig==29 & industry==62 & geography==8) | (geography_orig==29 & industry==62 & geography==44)
      Note: an additional qualifier geography==X is included because I restrict the treatment data for the job outflows from treatment states to other treatment states, given that the policy is based on reciprocity.

      *Generate the time-varying dummy variable i.e. equals 1 in state 's' after the policy adoption at quarter 'q', for health industry
      Code:
      gen post=0
      replace post=1 if (geography_orig==31 & qdate>= yq(2001,1) & industry==62)
      replace post=1 if (geography_orig==46 & qdate>= yq(2001,1) & industry==62)
      replace post=1 if (geography_orig==47 & qdate>= yq(2003,3) & industry==62)
      replace post=1 if (geography_orig==38 & qdate>= yq(2004,1) & industry==62)
      replace post=1 if (geography_orig==45 & qdate>= yq(2006,1) & industry==62)
      replace post=1 if (geography_orig==21 & qdate>= yq(2007,2) & industry==62)
      replace post=1 if (geography_orig==8 & qdate>= yq(2007,4) & industry==62)
      replace post=1 if (geography_orig==29 & qdate>= yq(2010,2) & industry==62)
      *Dummy for final treated observations (interacting treatment and post treatment times)
      Code:
      gen treat_post=treat*post
      So based on my understanding, this matches what you have explained above. Do let me know if I'm missing something here.

      Noted on your suggestion to look at the expected logj2j values by group. Will do so.

      Thank you again and looking forward to your response.

      Comment


      • #4
        It does not quite match up, and the difference is important.

        You regression in #1 includes treat_post, which is equivalent to the treatment#post interaction term. But it does not include treat and post themselves. They need to be there: a model with an interaction term that does not also separately include the component effects is usually mis-specified.

        My code includes i.treatment_group##i.pre_post. Note the double ##, not a single #. Stata expands a##b in to a b a#b, so my code includes the separate variables treatment_group and pre_post as well as their interaction. That is a crucial difference and it is what makes it possible to interpret the interaction term as the DID effect estimator. Without all of this, the interaction coefficient is not the DID estimator; in fact, it is difficult to assign a meaning to it that could be explained in simple terms.

        Comment


        • #5
          Dear Clyde,

          I understand now. Essentially the Stata code which includes the interaction terms as you have described translates into:

          Y= β0 + β1*[pre_post] + β2*[treatment_group] + β3*[pre_post*treatment_group] + β4*[covariates]+ε.

          Thank you again for your responses, they have been very helpful.

          Comment


          • #6
            Dear Clyde,

            I have a couple follow up questions in regards to my estimations.

            When I ran:
            Code:
            reg logj2j i.treat##i.pre_post i.geography_orig i.industry i.qdate, vce(cluster state_year)
            1. I did not lose the reference level for i.geography_orig and i.qdate, nor lose one more of each of those due to their collinearity with treat and pre_post. Should I be concerned?
            2. I have been trying to figure out how to show my results graphically, ideally in the form of a classic DiD graph, to show the effects before and after treatment. I know one way is to interact the treatment variable with time dummies. Correct me if I'm wrong, but my code includes this via "i.qdate" yes? I'm struggling to interpret the i.qdate results given that I have varying treatment periods for the different states.
            Your response would be highly appreciated.

            Comment


            • #7
              Apologies. Below is the Stata output, to make things clearer.

              HTML Code:
              Linear regression                               Number of obs     =    439,672
                                                              F(104, 325)       =     894.08
                                                              Prob > F          =     0.0000
                                                              R-squared         =     0.1425
                                                              Root MSE          =     1.2375
              
                                           (Std. Err. adjusted for 326 clusters in state_year)
              --------------------------------------------------------------------------------
                             |               Robust
                      logj2j |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ---------------+----------------------------------------------------------------
                     1.treat |  -.0325956   .0254653    -1.28   0.201    -.0826932     .017502
                      1.post |   .0088275   .0081284     1.09   0.278    -.0071635    .0248184
                             |
                  treat#post |
                        1 1  |   .1108097   .0341952     3.24   0.001     .0435379    .1780815
                             |
              geography_orig |
                          8  |   .0811839   .0201775     4.02   0.000     .0414889    .1208789
                         13  |   .4559484   .0160479    28.41   0.000     .4243775    .4875194
                         17  |   .5542518   .0162277    34.15   0.000     .5223272    .5861764
                         18  |   .2183878   .0158592    13.77   0.000     .1871881    .2495875
                         19  |  -.0940951   .0173114    -5.44   0.000    -.1281517   -.0600386
                         20  |  -.2346125   .0152505   -15.38   0.000    -.2646146   -.2046103
                         21  |   .0233557   .0175669     1.33   0.185    -.0112036    .0579149
                         27  |  -.0851506   .0159437    -5.34   0.000    -.1165165   -.0537848
                         29  |   .1330514   .0176117     7.55   0.000     .0984041    .1676987
                         31  |  -.3176764   .0195628   -16.24   0.000    -.3561621   -.2791908
                         38  |  -.4347112   .0822711    -5.28   0.000    -.5965624     -.27286
                         39  |   .4606229   .0174157    26.45   0.000     .4263612    .4948845
                         40  |  -.3016585   .0171402   -17.60   0.000    -.3353782   -.2679388
                         42  |   .3902172   .0178671    21.84   0.000     .3550675    .4253669
                         45  |  -.0418543   .0160648    -2.61   0.010    -.0734584   -.0102502
                         46  |  -.6229373    .016102   -38.69   0.000    -.6546146   -.5912601
                         47  |   .5215223   .0168384    30.97   0.000     .4883963    .5546483
                         54  |  -.0758871   .0183891    -4.13   0.000    -.1120639   -.0397104
                         56  |  -.3928094   .0296593   -13.24   0.000    -.4511577    -.334461
                             |
                    industry |
                         21  |   1.130536   .0529954    21.33   0.000     1.026278    1.234793
                         22  |  -.2887106   .0349564    -8.26   0.000    -.3574799   -.2199413
                         23  |   1.148886   .0270049    42.54   0.000     1.095759    1.202012
                         42  |   .3731822    .028841    12.94   0.000     .3164437    .4299207
                         51  |   .1504595   .0278358     5.41   0.000     .0956985    .2052206
                         52  |   .5740714   .0315586    18.19   0.000     .5119864    .6361564
                         53  |   .0479663   .0265361     1.81   0.072    -.0042379    .1001705
                         54  |   .7768359   .0333943    23.26   0.000     .7111396    .8425321
                         55  |  -.7706895   .0322668   -23.88   0.000    -.8341677   -.7072113
                         56  |   .7963394     .02911    27.36   0.000     .7390716    .8536072
                         61  |   .5599928   .0275482    20.33   0.000     .5057975    .6141882
                         62  |   .9411357   .0295487    31.85   0.000     .8830048    .9992665
                         71  |  -.0604728   .0262532    -2.30   0.022    -.1121206   -.0088251
                         72  |   1.097613   .0281423    39.00   0.000     1.042249    1.152977
                         81  |  -.0151508   .0267848    -0.57   0.572    -.0678442    .0375426
                         92  |  -.3474401   .0271264   -12.81   0.000    -.4008055   -.2940747
                       3133  |   .7326148   .0321022    22.82   0.000     .6694604    .7957692
                       4445  |   1.086175   .0295853    36.71   0.000     1.027972    1.144378
                       4849  |   1.167971   .0402167    29.04   0.000     1.088853    1.247089
                             |
                       qdate |
                        162  |   .4876185   .0130707    37.31   0.000     .4619047    .5133324
                        163  |    .194243   .0190676    10.19   0.000     .1567315    .2317545
                        164  |   .1779185   .0210617     8.45   0.000     .1364841    .2193529
                        165  |   .1209325   .0296618     4.08   0.000     .0625791    .1792859
                        166  |   .3773263   .0210889    17.89   0.000     .3358383    .4188143
                        167  |   .0495704   .0232322     2.13   0.034      .003866    .0952748
                        168  |    .019264   .0219202     0.88   0.380    -.0238594    .0623873
                        169  |   .0614463   .0234082     2.62   0.009     .0153955    .1074971
                        170  |   .3309069   .0230196    14.37   0.000     .2856206    .3761932
                        171  |   .0222437   .0221582     1.00   0.316     -.021348    .0658353
                        172  |  -.0109745   .0210439    -0.52   0.602     -.052374     .030425
                        173  |   .0185925   .0218736     0.85   0.396    -.0244391    .0616241
                        174  |   .2765327    .021187    13.05   0.000     .2348516    .3182137
                        175  |   .0145756   .0198451     0.73   0.463    -.0244656    .0536167
                        176  |   .0089923   .0213273     0.42   0.674    -.0329646    .0509492
                        177  |   .0591131   .0203663     2.90   0.004     .0190467    .0991794
                        178  |   .3160237   .0205611    15.37   0.000      .275574    .3564734
                        179  |   .0680732   .0214076     3.18   0.002     .0259583    .1101881
                        180  |   .0243321    .019561     1.24   0.214    -.0141502    .0628143
                        181  |   .0941825   .0195321     4.82   0.000     .0557573    .1326077
                        182  |   .3763686   .0197506    19.06   0.000     .3375135    .4152237
                        183  |   .0805643   .0202743     3.97   0.000     .0406788    .1204498
                        184  |   .1022227   .0198949     5.14   0.000     .0630835    .1413618
                        185  |   .1408327   .0209003     6.74   0.000     .0997157    .1819497
                        186  |   .4010959   .0198574    20.20   0.000     .3620305    .4401612
                        187  |   .1035614   .0193917     5.34   0.000     .0654123    .1417104
                        188  |   .1020249   .0200312     5.09   0.000     .0626178     .141432
                        189  |   .1535257   .0214502     7.16   0.000     .1113269    .1957245
                        190  |    .408113   .0201855    20.22   0.000     .3684023    .4478237
                        191  |   .1175261   .0206037     5.70   0.000     .0769926    .1580596
                        192  |   .1007695   .0218541     4.61   0.000     .0577761     .143763
                        193  |    .135137   .0200529     6.74   0.000     .0956871    .1745868
                        194  |   .3564031   .0203299    17.53   0.000     .3164083    .3963979
                        195  |   .0382288   .0219918     1.74   0.083    -.0050353     .081493
                        196  |  -.0617733   .0223586    -2.76   0.006    -.1057591   -.0177875
                        197  |  -.0810272   .0233982    -3.46   0.001    -.1270582   -.0349962
                        198  |   .1350821   .0198578     6.80   0.000      .096016    .1741481
                        199  |  -.0683229   .0220516    -3.10   0.002    -.1117047    -.024941
                        200  |  -.0923795   .0211301    -4.37   0.000    -.1339486   -.0508104
                        201  |  -.0206238   .0209916    -0.98   0.327    -.0619203    .0206727
                        202  |    .242204   .0220393    10.99   0.000     .1988463    .2855616
                        203  |   .0085203   .0234083     0.36   0.716    -.0375306    .0545712
                        204  |  -.0320998   .0209595    -1.53   0.127    -.0733332    .0091335
                        205  |    .041949   .0208061     2.02   0.045     .0010173    .0828807
                        206  |   .3404187    .021149    16.10   0.000     .2988125     .382025
                        207  |   .0390123   .0214527     1.82   0.070    -.0031915     .081216
                        208  |   .0576222   .0261186     2.21   0.028     .0062393     .109005
                        209  |   .0896637    .022131     4.05   0.000     .0461255    .1332018
                        210  |    .350512   .0241806    14.50   0.000     .3029418    .3980822
                        211  |   .0726362   .0222833     3.26   0.001     .0287985    .1164739
                        212  |   .0781218    .024141     3.24   0.001     .0306294    .1256141
                        213  |    .160149   .0236593     6.77   0.000     .1136044    .2066937
                        214  |   .4260816   .0217115    19.62   0.000     .3833688    .4687945
                        215  |   .1464332   .0220358     6.65   0.000     .1030823     .189784
                        216  |   .1261576   .0220111     5.73   0.000     .0828554    .1694599
                        217  |    .227018   .0225017    10.09   0.000     .1827507    .2712853
                        218  |   .4895532   .0221353    22.12   0.000     .4460065    .5330998
                        219  |   .1961686   .0236624     8.29   0.000     .1496178    .2427195
                        220  |   .1873416   .0242791     7.72   0.000     .1395776    .2351056
                        221  |   .2676014   .0258836    10.34   0.000     .2166809    .3185219
                        222  |   .5416584   .0228846    23.67   0.000     .4966377    .5866791
                        223  |   .2482819   .0226765    10.95   0.000     .2036707    .2928931
                        224  |   .2037281   .0211796     9.62   0.000     .1620617    .2453945
                             |
                       _cons |   .9783714   .0350266    27.93   0.000      .909464    1.047279
              --------------------------------------------------------------------------------

              Comment


              • #8
                Well, you did lose the reference category for qdate. You said your data is quarterly from 2000Q2 through 2016Q1.

                Code:
                . display quarterly("2000Q2", "YQ"), quarterly("2016Q1", "YQ")
                161 224
                So the reference level is 161, and your output indicators for qdate begin with 162.

                I have no comparable information about the geography_orig variable's values, but I'm confident if you look carefully you will find that one of them is not listed in the output.

                As for graphical display, there are several different graphs that might be called "classic DID" and I'm not sure what you have in mind. In particular, I think you have to distinguish graphing your model results from graphing the raw data.

                Your model does not really incorporate DID outcome vs time information. Your model has pre-post as a dichotomous variable, so basically you just have modeled four data points: treat-pre, treat-post, control-pre, and control-post. That doesn't lend itself to an interesting graph. You could, of course do a bar graph, or you could do a "timeline" for treat and for post that only has a beginning and end. But really those are just wasting a lot of pixels (ink) to show something that has very little graphic content and is better conveyed in a table. The inclusion of i.qdate in your model allows your model to adjust for quarterly shocks to the outcome, but because qdate is not interacted with treatment, it does not really distinguish the groups in that way.

                While you could do a different model that interacts treat with i.qdate, that is really modeling having separate shocks in the treatment and control group, and it does not easily lend itself to testing a treatment effect.

                The kind of DID model that best lends itself to graphic display is where the passage of time is treated as imposing a linear trend on the outcome which may change direction when treatment is initiated. You can generate graphs that show trend lines for both groups, ideally running parallel before the treatment era and then diverging afterward. But, again, this is a different model from what you did, and it presumes that the effect of treatment is not to provide a "jump" in the outcome but to "bend the curve." So this is a substantively very different model.

                Comment


                • #9
                  Dear Clyde,

                  Yes, you are right in that i am missing one geography_orig value. I overlooked this.

                  In terms of the graphical display, I should have been more specific. As you have mentioned, I have read that one way to see the treatment effect over time is indeed by creating time dummies and interacting them with the treatment variable. For simple illustration purposes, perhaps something like this:

                  Yi,s,t = γi + γs + γt + β-5 Dist + ...+ β-2 Dist + β-1 Dist + β1 Dist 2 Dist + ...+ β7 Dist + εi,s,t

                  This way, I can visualise the pre-tends (and also the post-treatment trends). In an ideal world, the β coefficients prior to the treatment should be insignificant. These coefficients can then be graphed to see the effect over time.

                  That said, I was just unsure of how this works when there are multiple treatment periods involved - i.e. whether I create all the time dummies, then run the regression individually by geography_orig, or whether it could be done at one go.

                  Thank you for your consideration.


                  Comment


                  • #10
                    So, one approach would be something like this:

                    Code:
                    collapse (mean) logj2j, by(treat qdate)
                    reshape wide logj2j, i(qdate) j(treat)
                    graph twoway line logj2j* qdate, sort
                    This is, to be very clear, a graph of the mean observed logj2j over time in each groups. It is not a graph of your model results.

                    You could also do something like:
                    Code:
                    reg logj2j i.treat##i.qdate i.geography_orig i.industry, vce(cluster state_year)
                    margins treat#qdate
                    marginsplot
                    This will give you graphs of modeled logj2j over time in each group, but it is a different model from the one you have been talking about.

                    The model you have done up to this point does not lend itself to any interesting graphs: it has only 4 points and is best displayed in a table.

                    Comment


                    • #11
                      Thank you Clyde. I will give it a go. This has all been very helpful.

                      Comment

                      Working...
                      X