Announcement

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

  • relationship between coefficients on the interactions of treatment and time dummies and coeffcients on treatment*post

    I have the following data set where I have a number of treat and control firms indicated by the "treat" dummy.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(year month) str6 year_month float(treat ind3_code year_month_c y)
    2019  1 "20191"  0  9  6    3.533689
    2019 10 "201910" 0  9 15    4.623012
    2019 11 "201911" 0  9 16    1.274461
    2019 12 "201912" 0  9 17    7.730598
    2019  2 "20192"  0  9  7    6.124292
    2019  3 "20193"  0  9  8   10.031496
    2019  4 "20194"  0  9  9    8.790927
    2019  5 "20195"  0  9 10    4.740323
    2019  6 "20196"  0  9 11    .4423816
    2019  7 "20197"  0  9 12    .4193151
    2019  8 "20198"  0  9 13    .0819123
    2019  9 "20199"  0  9 14    4.857184
    2020  1 "20201"  0  9 18    9.590326
    2020 10 "202010" 0  9 27    6.798239
    2020 11 "202011" 0  9 28    8.679753
    2020 12 "202012" 0  9 29   4.5498023
    2020  2 "20202"  0  9 19    9.591087
    2020  3 "20203"  0  9 20    6.939636
    2020  4 "20204"  0  9 21   .14198092
    2020  5 "20205"  0  9 22   1.9564253
    2020  6 "20206"  0  9 23    5.456525
    2020  7 "20207"  0  9 24    7.099039
    2020  8 "20208"  0  9 25   1.1000764
    2020  9 "20209"  0  9 26    8.961788
    2021  1 "20211"  0  9 30    .8228391
    2021  2 "20212"  0  9 31     1.19692
    2021  3 "20213"  0  9 32    7.815795
    2018 10 "201810" 0 27  3    1.825695
    2018 11 "201811" 0 27  4   1.2361627
    2018 12 "201812" 0 27  5    6.957359
    2018  8 "20188"  0 27  1    2.109008
    2018  9 "20189"  0 27  2   2.2285697
    2019  1 "20191"  0 27  6      3.3959
    2019  2 "20192"  0 27  7    3.302672
    2019  3 "20193"  0 27  8   3.9273214
    2019  4 "20194"  0 27  9 .0042833816
    2019  5 "20195"  0 27 10     7.27686
    2019  6 "20196"  0 27 11   1.3466753
    2019  7 "20197"  0 27 12    .4504642
    2019  8 "20198"  0 27 13    8.953969
    2019  9 "20199"  0 27 14    6.018908
    2018 10 "201810" 0 27  3    6.866826
    2018 11 "201811" 0 27  4    7.163794
    2018 12 "201812" 0 27  5    6.703581
    2018  8 "20188"  0 27  1   4.5353284
    2018  9 "20189"  0 27  2   3.3916595
    2019  1 "20191"  0 27  6    5.828989
    2019 10 "201910" 0 27 15    8.903518
    2019 11 "201911" 0 27 16     6.33075
    2019 12 "201912" 0 27 17    .6888227
    2019  2 "20192"  0 27  7     7.06424
    2019  3 "20193"  0 27  8    8.162328
    2019  4 "20194"  0 27  9 -.010218575
    2019  5 "20195"  0 27 10   3.5556576
    2019  6 "20196"  0 27 11    8.572945
    2019  7 "20197"  0 27 12   2.4939535
    2019  8 "20198"  0 27 13    2.678189
    2019  9 "20199"  0 27 14    7.687457
    2020  1 "20201"  0 27 18    6.320674
    2020 10 "202010" 0 27 27    5.351401
    2020 11 "202011" 0 27 28    5.024953
    2020 12 "202012" 0 27 29    6.084361
    2020  2 "20202"  0 27 19    8.056747
    2020  3 "20203"  0 27 20    8.768842
    2020  4 "20204"  0 27 21   2.4430835
    2020  5 "20205"  0 27 22    8.275479
    2020  6 "20206"  0 27 23    8.087458
    2020  7 "20207"  0 27 24    .4250393
    2020  8 "20208"  0 27 25    4.748792
    2020  9 "20209"  0 27 26   2.1541874
    2021  1 "20211"  0 27 30    7.691447
    2021  2 "20212"  0 27 31    3.012689
    2021  3 "20213"  0 27 32    .6683018
    2020  1 "20201"  0  9 18    3.717996
    2020 10 "202010" 0  9 27    3.632449
    2020 11 "202011" 0  9 28    2.878982
    2020 12 "202012" 0  9 29    6.638168
    2020  2 "20202"  0  9 19   4.4057684
    2020  3 "20203"  0  9 20    9.801064
    2020  4 "20204"  0  9 21    3.331873
    2020  5 "20205"  0  9 22   1.1952995
    2020  6 "20206"  0  9 23     1.51032
    2020  7 "20207"  0  9 24    6.938107
    2020  8 "20208"  0  9 25   .01384309
    2020  9 "20209"  0  9 26     8.90509
    2018 10 "201810" 0  9  3   3.7120464
    2018 11 "201811" 0  9  4   2.5781066
    2018 12 "201812" 0  9  5    7.455093
    2018  8 "20188"  0  9  1    9.563288
    2018  9 "20189"  0  9  2    7.263426
    2019  1 "20191"  0  9  6    5.416348
    2019 10 "201910" 0  9 15    .6352155
    2019 11 "201911" 0  9 16    7.628274
    2019 12 "201912" 0  9 17    1.420605
    2019  2 "20192"  0  9  7    2.402516
    2019  3 "20193"  0  9  8    8.643309
    2019  4 "20194"  0  9  9    7.888723
    2019  5 "20195"  0  9 10     7.90661
    2019  6 "20196"  0  9 11    9.748446
    2019  7 "20197"  0  9 12     6.66818
    2019  8 "20198"  0  9 13    6.678521
    2019  9 "20199"  0  9 14    9.204957
    2020  1 "20201"  0  9 18    3.003242
    2020 10 "202010" 0  9 27    9.428153
    2020 11 "202011" 0  9 28   1.1929506
    2020 12 "202012" 0  9 29   1.9244084
    2020  2 "20202"  0  9 19    7.753702
    2020  3 "20203"  0  9 20    9.057234
    2020  4 "20204"  0  9 21      7.3886
    2020  5 "20205"  0  9 22    8.408674
    2020  6 "20206"  0  9 23    7.513569
    2020  7 "20207"  0  9 24   2.3045537
    2020  8 "20208"  0  9 25   1.7342184
    2020  9 "20209"  0  9 26    .8647256
    2021  1 "20211"  0  9 30    6.329988
    2021  2 "20212"  0  9 31   2.3335297
    2021  3 "20213"  0  9 32    3.225954
    2018 10 "201810" 0  9  3   4.3705716
    2018 11 "201811" 0  9  4    .8469349
    2018 12 "201812" 0  9  5    1.638725
    2018  8 "20188"  0  9  1    9.790879
    2018  9 "20189"  0  9  2   3.0363605
    2019  1 "20191"  0  9  6    4.441983
    2019 10 "201910" 0  9 15   10.102244
    2019 11 "201911" 0  9 16     4.31952
    2019 12 "201912" 0  9 17    7.665234
    2019  2 "20192"  0  9  7   1.0445601
    2019  3 "20193"  0  9  8    8.930622
    2019  4 "20194"  0  9  9   .19009824
    2019  5 "20195"  0  9 10    6.310043
    2019  6 "20196"  0  9 11    8.884526
    2019  7 "20197"  0  9 12    3.014095
    2019  8 "20198"  0  9 13  -.06914096
    2019  9 "20199"  0  9 14    8.473163
    2020  1 "20201"  0  9 18    2.706152
    2020 10 "202010" 0  9 27    .6434497
    2020  2 "20202"  0  9 19   .17356275
    2020  3 "20203"  0  9 20    8.248734
    2020  4 "20204"  0  9 21    7.783752
    2020  5 "20205"  0  9 22    5.746327
    2020  6 "20206"  0  9 23     5.56095
    2020  7 "20207"  0  9 24    5.834881
    2020  8 "20208"  0  9 25    4.959742
    2020  9 "20209"  0  9 26    6.530029
    2018 10 "201810" 1 40  3    7.754977
    2018 11 "201811" 1 40  4   .02894541
    2018 12 "201812" 1 40  5    8.085847
    2018  8 "20188"  1 40  1    6.232292
    2018  9 "20189"  1 40  2   2.3495069
    2019  1 "20191"  1 40  6    3.721237
    2019 10 "201910" 1 40 15    5.076848
    2019 11 "201911" 1 40 16     7.38858
    2019 12 "201912" 1 40 17    5.625891
    2019  2 "20192"  1 40  7    .8325879
    2019  3 "20193"  1 40  8    7.172107
    2019  4 "20194"  1 40  9    3.282642
    2019  5 "20195"  1 40 10     5.44907
    2019  6 "20196"  1 40 11    6.815018
    2019  7 "20197"  1 40 12    1.898395
    2019  8 "20198"  1 40 13    3.766986
    2019  9 "20199"  1 40 14   4.0202003
    2020  1 "20201"  1 40 18   4.5864644
    2020 10 "202010" 1 40 27    5.455174
    2020 11 "202011" 1 40 28     8.51354
    2020 12 "202012" 1 40 29    .7753707
    2020  2 "20202"  1 40 19    5.887803
    2020  3 "20203"  1 40 20      6.6939
    2020  4 "20204"  1 40 21    6.328744
    2020  5 "20205"  1 40 22    8.807063
    2020  6 "20206"  1 40 23   4.5260687
    2020  7 "20207"  1 40 24   2.0946603
    2020  8 "20208"  1 40 25    6.620865
    2020  9 "20209"  1 40 26    4.398757
    2021  1 "20211"  1 40 30       .9259
    2021  2 "20212"  1 40 31    2.935745
    2021  3 "20213"  1 40 32    .4075056
    2018 10 "201810" 0 25  3    5.976005
    2018 11 "201811" 0 25  4   .11457504
    2018 12 "201812" 0 25  5    8.798559
    2018  8 "20188"  0 25  1    .3006993
    2018  9 "20189"  0 25  2     6.46421
    2019  1 "20191"  0 25  6   3.6124635
    2019 10 "201910" 0 25 15   2.7865186
    2019 11 "201911" 0 25 16    4.890226
    2019 12 "201912" 0 25 17    2.799066
    2019  2 "20192"  0 25  7    7.151778
    2019  3 "20193"  0 25  8    8.567761
    2019  4 "20194"  0 25  9    8.678613
    2019  5 "20195"  0 25 10    2.365629
    2019  6 "20196"  0 25 11    7.685627
    2019  7 "20197"  0 25 12   3.9277806
    2019  8 "20198"  0 25 13   4.6925335
    2019  9 "20199"  0 25 14   1.6191373
    2020  1 "20201"  0 25 18    8.263336
    2020 10 "202010" 0 25 27    .4201417
    2020 11 "202011" 0 25 28    2.672808
    2020  2 "20202"  0 25 19   8.0656595
    2020  3 "20203"  0 25 20   3.7176204
    2020  4 "20204"  0 25 21    3.485199
    2020  5 "20205"  0 25 22    8.199381
    2020  6 "20206"  0 25 23   1.8450886
    2020  7 "20207"  0 25 24    1.535846
    2020  8 "20208"  0 25 25    1.499506
    2020  9 "20209"  0 25 26    7.224507
    2018 10 "201810" 0  9  3    3.775818
    2018 11 "201811" 0  9  4    5.735529
    2018 12 "201812" 0  9  5   -.1520811
    2018  8 "20188"  0  9  1    3.010874
    2018  9 "20189"  0  9  2    4.193386
    2019  1 "20191"  0  9  6    8.902131
    2019 10 "201910" 0  9 15    7.275138
    2019 11 "201911" 0  9 16    5.849213
    2019 12 "201912" 0  9 17    6.337542
    2019  2 "20192"  0  9  7   2.1444368
    2019  3 "20193"  0  9  8    2.903483
    2019  4 "20194"  0  9  9    2.609072
    2019  5 "20195"  0  9 10    5.675027
    2019  6 "20196"  0  9 11    5.631131
    2019  7 "20197"  0  9 12    3.372003
    2019  8 "20198"  0  9 13    8.216531
    2019  9 "20199"  0  9 14    5.875797
    2020  1 "20201"  0  9 18    7.452524
    2020 10 "202010" 0  9 27    8.750829
    2020 11 "202011" 0  9 28   2.7384744
    2020 12 "202012" 0  9 29    7.821986
    2020  2 "20202"  0  9 19   1.5615367
    2020  3 "20203"  0  9 20   .21987346
    2020  4 "20204"  0  9 21    8.504027
    2020  5 "20205"  0  9 22     6.46848
    2020  6 "20206"  0  9 23   4.2816224
    2020  7 "20207"  0  9 24    6.255497
    2020  8 "20208"  0  9 25    6.721773
    2020  9 "20209"  0  9 26   1.2665868
    2021  1 "20211"  0  9 30   4.0677843
    2021  2 "20212"  0  9 31     6.15018
    2021  3 "20213"  0  9 32    9.127183
    2018 10 "201810" 1 40  3    .2397677
    2018 11 "201811" 1 40  4    9.098163
    2018 12 "201812" 1 40  5    6.878891
    2018  8 "20188"  1 40  1    7.705475
    2018  9 "20189"  1 40  2    8.059814
    2019  1 "20191"  1 40  6    5.669284
    2019 10 "201910" 1 40 15   .56963056
    2019 11 "201911" 1 40 16    2.466423
    2019 12 "201912" 1 40 17   1.6816995
    2019  2 "20192"  1 40  7   10.272449
    2019  3 "20193"  1 40  8    7.688681
    2019  4 "20194"  1 40  9    6.915909
    2019  5 "20195"  1 40 10    9.170772
    2019  6 "20196"  1 40 11    2.443267
    2019  7 "20197"  1 40 12    2.751082
    2019  8 "20198"  1 40 13    .4396245
    2019  9 "20199"  1 40 14    3.085705
    2020  1 "20201"  1 40 18    .7060227
    2020 10 "202010" 1 40 27   4.4707074
    2020 11 "202011" 1 40 28    2.010524
    2020 12 "202012" 1 40 29    9.291284
    2020  2 "20202"  1 40 19    .6889345
    2020  3 "20203"  1 40 20   .59329623
    2020  4 "20204"  1 40 21    5.089862
    2020  5 "20205"  1 40 22   1.2854624
    2020  6 "20206"  1 40 23    8.669716
    2020  7 "20207"  1 40 24    .3937246
    2020  8 "20208"  1 40 25    9.525309
    2020  9 "20209"  1 40 26     9.81271
    2021  1 "20211"  1 40 30   .12010994
    2021  2 "20212"  1 40 31    8.718388
    2021  3 "20213"  1 40 32   1.1474758
    2018 10 "201810" 0  9  3    1.108712
    2018 11 "201811" 0  9  4    .9231041
    2018 12 "201812" 0  9  5    6.171976
    2018  8 "20188"  0  9  1    .9404076
    2018  9 "20189"  0  9  2   2.5976355
    2019  1 "20191"  0  9  6    9.639495
    2019 10 "201910" 0  9 15    4.865177
    2019 11 "201911" 0  9 16    6.734227
    2019 12 "201912" 0  9 17    2.870469
    2019  2 "20192"  0  9  7    7.840401
    2019  3 "20193"  0  9  8   4.4260254
    2019  4 "20194"  0  9  9    6.653377
    2019  5 "20195"  0  9 10    6.535165
    2019  6 "20196"  0  9 11    6.822266
    2019  7 "20197"  0  9 12    3.978481
    2019  8 "20198"  0  9 13    7.675358
    2019  9 "20199"  0  9 14  -.03120381
    2018 10 "201810" 1 40  3    7.969313
    2018 11 "201811" 1 40  4    5.566231
    2018 12 "201812" 1 40  5    4.687722
    2018  8 "20188"  1 40  1   4.3496456
    2018  9 "20189"  1 40  2   2.1796577
    2019  1 "20191"  1 40  6     7.61565
    2019 10 "201910" 1 40 15    9.683228
    2019 11 "201911" 1 40 16    5.749743
    2019 12 "201912" 1 40 17   3.6171374
    2019  2 "20192"  1 40  7      8.5262
    2019  3 "20193"  1 40  8     9.51534
    2019  4 "20194"  1 40  9   4.1396112
    2019  5 "20195"  1 40 10    5.134404
    2019  6 "20196"  1 40 11     5.64292
    2019  7 "20197"  1 40 12    5.106074
    2019  8 "20198"  1 40 13    7.083689
    2019  9 "20199"  1 40 14   .12375187
    2020  1 "20201"  1 40 18    9.956807
    2020 10 "202010" 1 40 27    5.937571
    2020 11 "202011" 1 40 28    3.127404
    2020 12 "202012" 1 40 29    6.380744
    2020  2 "20202"  1 40 19   3.5631514
    2020  3 "20203"  1 40 20    9.622343
    2020  4 "20204"  1 40 21   8.9865055
    2020  5 "20205"  1 40 22    .8544613
    2020  6 "20206"  1 40 23    9.180718
    2020  7 "20207"  1 40 24   1.6766287
    2020  8 "20208"  1 40 25   2.1812272
    2020  9 "20209"  1 40 26      7.1474
    2021  1 "20211"  1 40 30     9.03538
    2021  2 "20212"  1 40 31    2.497206
    2021  3 "20213"  1 40 32   1.9131882
    2018 10 "201810" 0  1  3   4.4823704
    2018 11 "201811" 0  1  4    9.317528
    2018 12 "201812" 0  1  5    7.195023
    2018  8 "20188"  0  1  1    3.842241
    2018  9 "20189"  0  1  2    .6312331
    2018 10 "201810" 1 40  3    9.280899
    2018 11 "201811" 1 40  4    7.627875
    2018 12 "201812" 1 40  5    5.679721
    2018  8 "20188"  1 40  1    8.361551
    2018  9 "20189"  1 40  2    4.188936
    2019  1 "20191"  1 40  6    .7811348
    2019 10 "201910" 1 40 15      5.7349
    2019 11 "201911" 1 40 16    6.967733
    2019 12 "201912" 1 40 17    1.511556
    2019  2 "20192"  1 40  7    5.202242
    2019  3 "20193"  1 40  8   1.9068187
    2019  4 "20194"  1 40  9    4.615948
    2019  5 "20195"  1 40 10    .5793773
    2019  6 "20196"  1 40 11    5.363412
    2019  7 "20197"  1 40 12  -.07862775
    2019  8 "20198"  1 40 13    7.311556
    2019  9 "20199"  1 40 14   1.7404075
    2020  1 "20201"  1 40 18    4.772023
    2020 10 "202010" 1 40 27   3.6372724
    2020 11 "202011" 1 40 28   3.3409014
    2020 12 "202012" 1 40 29    .8243132
    2020  2 "20202"  1 40 19    8.984507
    2020  3 "20203"  1 40 20    .2682127
    2020  4 "20204"  1 40 21   1.2340344
    2020  5 "20205"  1 40 22    .8207581
    2020  6 "20206"  1 40 23    7.217927
    2020  7 "20207"  1 40 24    1.363565
    2020  8 "20208"  1 40 25   2.3041565
    2020  9 "20209"  1 40 26   1.7743312
    2021  1 "20211"  1 40 30   2.0359025
    2021  2 "20212"  1 40 31    9.058302
    2021  3 "20213"  1 40 32    6.461065
    2018 10 "201810" 0  9  3   1.2212433
    2018 11 "201811" 0  9  4    8.242736
    2018 12 "201812" 0  9  5    4.951109
    2018  8 "20188"  0  9  1     3.32671
    2018  9 "20189"  0  9  2   2.1232464
    2019  1 "20191"  0  9  6   1.0521011
    2019 10 "201910" 0  9 15    7.857421
    2019 11 "201911" 0  9 16    9.303766
    2019 12 "201912" 0  9 17    .7711078
    2019  2 "20192"  0  9  7    4.850563
    2019  3 "20193"  0  9  8    7.608701
    2019  4 "20194"  0  9  9    7.259295
    2019  5 "20195"  0  9 10    8.144084
    2019  6 "20196"  0  9 11    8.721997
    2019  7 "20197"  0  9 12    2.586372
    2019  8 "20198"  0  9 13    6.047177
    2019  9 "20199"  0  9 14   4.7197566
    2020  1 "20201"  0  9 18   1.5225674
    2020 10 "202010" 0  9 27   .23214938
    2020 11 "202011" 0  9 28    8.297063
    2020 12 "202012" 0  9 29   3.3773944
    2020  2 "20202"  0  9 19    8.513958
    2020  3 "20203"  0  9 20    .4246383
    2020  4 "20204"  0  9 21    7.678414
    2020  5 "20205"  0  9 22    2.579587
    2020  6 "20206"  0  9 23    9.477227
    2020  7 "20207"  0  9 24    9.387574
    2020  8 "20208"  0  9 25    7.986716
    2020  9 "20209"  0  9 26    1.244926
    2021  1 "20211"  0  9 30    5.723133
    2018 10 "201810" 0  9  3    2.393986
    2018 11 "201811" 0  9  4    9.882178
    2018 12 "201812" 0  9  5    2.714946
    2018  8 "20188"  0  9  1   1.2831987
    2018  9 "20189"  0  9  2    .3200619
    2019  1 "20191"  0  9  6    1.667642
    2019 10 "201910" 0  9 15     .717705
    2019 11 "201911" 0  9 16    7.285248
    2019 12 "201912" 0  9 17   3.2716775
    2019  2 "20192"  0  9  7    7.044349
    2019  3 "20193"  0  9  8   2.8273525
    2019  4 "20194"  0  9  9    5.384037
    2019  5 "20195"  0  9 10    6.807844
    2019  6 "20196"  0  9 11    6.575269
    2019  7 "20197"  0  9 12    3.509325
    2019  8 "20198"  0  9 13    2.745626
    2019  9 "20199"  0  9 14    2.954362
    2020  1 "20201"  0  9 18    8.606144
    2020 10 "202010" 0  9 27     7.99339
    2020 11 "202011" 0  9 28    5.505187
    2020 12 "202012" 0  9 29    7.860959
    2020  2 "20202"  0  9 19   1.3955384
    2020  3 "20203"  0  9 20   .05578054
    2020  4 "20204"  0  9 21    .6702116
    2020  5 "20205"  0  9 22    4.942846
    2020  6 "20206"  0  9 23    4.386099
    2020  7 "20207"  0  9 24   1.1759576
    2020  8 "20208"  0  9 25    8.343729
    2020  9 "20209"  0  9 26    4.780529
    2021  1 "20211"  0  9 30   2.1436427
    2021  2 "20212"  0  9 31    4.890048
    2021  3 "20213"  0  9 32     1.85541
    2018 10 "201810" 0  9  3   1.1456699
    2018 11 "201811" 0  9  4    1.547843
    2018 12 "201812" 0  9  5    5.317666
    2018  8 "20188"  0  9  1    7.045587
    2018  9 "20189"  0  9  2     3.06757
    2019  1 "20191"  0  9  6   2.3010592
    2019 10 "201910" 0  9 15   2.3323898
    2019 11 "201911" 0  9 16    .9371019
    2019 12 "201912" 0  9 17    8.257097
    2019  2 "20192"  0  9  7   1.6937568
    2019  3 "20193"  0  9  8    8.270033
    2019  4 "20194"  0  9  9    2.054113
    2019  5 "20195"  0  9 10   2.1731987
    2019  6 "20196"  0  9 11    8.765087
    2019  7 "20197"  0  9 12    4.474798
    2019  8 "20198"  0  9 13    2.765065
    2019  9 "20199"  0  9 14    4.147869
    2020  1 "20201"  0  9 18    1.706628
    2020 10 "202010" 0  9 27   4.5809913
    2020 11 "202011" 0  9 28    8.912842
    2020 12 "202012" 0  9 29   .07903917
    2020  2 "20202"  0  9 19   4.4814944
    2020  3 "20203"  0  9 20   1.5171982
    2020  4 "20204"  0  9 21    5.082428
    2020  5 "20205"  0  9 22    2.932981
    2020  6 "20206"  0  9 23    6.061301
    2020  7 "20207"  0  9 24    9.238971
    2020  8 "20208"  0  9 25    3.631132
    2020  9 "20209"  0  9 26    9.930732
    2021  1 "20211"  0  9 30    1.793153
    2021  2 "20212"  0  9 31    3.658489
    2021  3 "20213"  0  9 32    2.836752
    2018 10 "201810" 0  1  3     .392072
    2018 11 "201811" 0  1  4    6.068316
    2018 12 "201812" 0  1  5    9.385101
    2018  8 "20188"  0  1  1    .6518202
    2018  9 "20189"  0  1  2     7.19049
    2019  1 "20191"  0  1  6    .3608057
    2019 10 "201910" 0  1 15    6.722629
    2019 11 "201911" 0  1 16    5.151308
    2019 12 "201912" 0  1 17    5.644791
    2019  2 "20192"  0  1  7    8.417883
    2019  3 "20193"  0  1  8    9.809309
    2019  4 "20194"  0  1  9    2.299094
    2019  5 "20195"  0  1 10     5.49826
    2019  6 "20196"  0  1 11    9.364619
    2019  7 "20197"  0  1 12    1.226144
    2019  8 "20198"  0  1 13    5.618271
    2019  9 "20199"  0  1 14    .6483236
    2020  1 "20201"  0  1 18    .7361569
    2020  2 "20202"  0  1 19   1.6322197
    2020  3 "20203"  0  1 20    3.463088
    2020  4 "20204"  0  1 21    3.822316
    2020  5 "20205"  0  1 22    9.216046
    2018 10 "201810" 0  1  3   1.3424745
    2018 11 "201811" 0  1  4    6.949234
    2018 12 "201812" 0  1  5     5.70474
    2018  8 "20188"  0  1  1    .4438354
    2018  9 "20189"  0  1  2   2.9509246
    2019  1 "20191"  0  1  6   2.2191827
    2019  2 "20192"  0  1  7    7.999144
    2019  3 "20193"  0  1  8    9.051006
    2019  4 "20194"  0  1  9    7.874681
    2019  5 "20195"  0  1 10    .5263755
    2018 10 "201810" 0  9  3    8.046903
    2018 11 "201811" 0  9  4    8.277057
    2018 12 "201812" 0  9  5    5.795954
    2018  8 "20188"  0  9  1    2.537629
    2018  9 "20189"  0  9  2   2.0996914
    2019  1 "20191"  0  9  6    8.316992
    2019 10 "201910" 0  9 15     6.21144
    2019 11 "201911" 0  9 16   1.9922885
    2019 12 "201912" 0  9 17    1.752224
    2019  2 "20192"  0  9  7     .823098
    2019  3 "20193"  0  9  8    8.692416
    2019  4 "20194"  0  9  9    8.126968
    2019  5 "20195"  0  9 10    6.761196
    2019  6 "20196"  0  9 11    4.622118
    2019  7 "20197"  0  9 12    6.943169
    2019  8 "20198"  0  9 13    5.715853
    2019  9 "20199"  0  9 14    9.578526
    2020  1 "20201"  0  9 18    1.889126
    2020 10 "202010" 0  9 27     2.16206
    2020 11 "202011" 0  9 28     4.94149
    end

    I have two shocks and I created two dummy variables to indicate them

    Code:
    * first shock (2019.8-2020.3)
    gen post = 0
    replace post = 1 if year == 2019 & month >= 8
    replace post = 1 if year == 2020 & month <= 3
    
    * second shock (2020.4-2021-3)
    gen post2 = 0
    replace post2 = 1 if year == 2020 & month > 3
    
    gen treat_post = treat * post
    gen treat_post2 = treat * post2
    
    * generate time dummies
    tabulate year_month_c, generate(t)
    sort year month
    
    * interact time dummies with the treatment variable for months in the post period
    foreach var of varlist t13-t32{
    gen `var'_treat = `var'*treat
    }
    Then I run the following two regressions

    Code:
    reghdfe y treat_post treat_post2 , a(ind3_code year_month_c i.ind3_code#c.year_month_c) cluster(ind3_code)
    reghdfe y  t13_treat - t32_treat, a(ind3_code year_month_c  i.ind3_code#c.year_month_c) cluster(ind3_code)
    ind3_code, year_month_c, and i.ind3_code#c.year_month_c controls for industry, year fixed effects, and industry-specific time trends.

    I expect that the coefficient on "treat_post" will be approximately equal to the weighted average of the coefficients on the variables from t13_treat to t20_treat, and the coefficient on treat_post2 will be approximately equal to the weighted average of the coefficients on the variables from t21_treat to t32_treat.

    However, the results were not as expected. I'm confused especially about the coefficient on t21_treat to t32_treat. They are mostly positive and statistically significant, whereas the estimated coefficient on treat_post2 is negative. Is my expectation wrong, or is there something wrong with the codes?




    Attached Files

  • #2
    You've got repeated dates for ind3_code.




    clear
    input float ind3_code str6 year_month
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201810"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201811"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "201812"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20188"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20189"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "20191"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201910"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201911"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "201912"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20192"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20193"
    9 "20194"
    9 "20194"
    9 "20194"
    9 "20194"
    9 "20194"
    9 "20194"
    end
    [/CODE]

    Comment


    • #3
      Hi George, thanks for your answer! The original data set is at the company-year level but the shocks are at the industry level. I've added a column of firm IDs (id). But I had the same problem when I ran the following:

      Code:
      reghdfe y treat_post treat_post2 , a(id year_month_c i.id#c.year_month_c) cluster(id)
      reghdfe y  t13_treat - t32_treat, a(id year_month_c  i.id#c.year_month_c) cluster(id)
      Data with firm ids
      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input float(year month) str6 year_month float(treat ind3_code year_month_c y id)
      2019  1 "20191"  0  9  6     7.55207  1
      2019 10 "201910" 0  9 15    .9786136  1
      2019 11 "201911" 0  9 16    1.402468  1
      2019 12 "201912" 0  9 17    2.684008  1
      2019  2 "20192"  0  9  7    7.617968  1
      2019  3 "20193"  0  9  8    9.706656  1
      2019  4 "20194"  0  9  9    1.361796  1
      2019  5 "20195"  0  9 10    8.378426  1
      2019  6 "20196"  0  9 11    7.030532  1
      2019  7 "20197"  0  9 12    5.920337  1
      2019  8 "20198"  0  9 13    8.963018  1
      2019  9 "20199"  0  9 14    5.672304  1
      2020  1 "20201"  0  9 18    9.840922  1
      2020 10 "202010" 0  9 27    8.086982  1
      2020 11 "202011" 0  9 28    8.508053  1
      2020 12 "202012" 0  9 29    .7565481  1
      2020  2 "20202"  0  9 19    3.660541  1
      2020  3 "20203"  0  9 20  .009630573  1
      2020  4 "20204"  0  9 21    8.275305  1
      2020  5 "20205"  0  9 22    3.318109  1
      2020  6 "20206"  0  9 23    9.232048  1
      2020  7 "20207"  0  9 24    .7320248  1
      2020  8 "20208"  0  9 25   8.2603655  1
      2020  9 "20209"  0  9 26    4.463721  1
      2021  1 "20211"  0  9 30     7.05222  1
      2021  2 "20212"  0  9 31   1.1408604  1
      2021  3 "20213"  0  9 32    4.813996  1
      2018 10 "201810" 0 27  3    9.004827  2
      2018 11 "201811" 0 27  4    8.984754  2
      2018 12 "201812" 0 27  5    .7181233  2
      2018  8 "20188"  0 27  1    5.532055  2
      2018  9 "20189"  0 27  2    4.310487  2
      2019  1 "20191"  0 27  6    7.552517  2
      2019  2 "20192"  0 27  7    7.244119  2
      2019  3 "20193"  0 27  8    4.320543  2
      2019  4 "20194"  0 27  9    5.175291  2
      2019  5 "20195"  0 27 10      6.6696  2
      2019  6 "20196"  0 27 11   3.4046366  2
      2019  7 "20197"  0 27 12   3.7914956  2
      2019  8 "20198"  0 27 13     .335326  2
      2019  9 "20199"  0 27 14    6.844749  2
      2018 10 "201810" 0 27  3    1.844738  3
      2018 11 "201811" 0 27  4     9.65198  3
      2018 12 "201812" 0 27  5    9.988294  3
      2018  8 "20188"  0 27  1    7.598196  3
      2018  9 "20189"  0 27  2    9.392284  3
      2019  1 "20191"  0 27  6    1.938892  3
      2019 10 "201910" 0 27 15    8.883771  3
      2019 11 "201911" 0 27 16   1.8023335  3
      2019 12 "201912" 0 27 17    6.246184  3
      2019  2 "20192"  0 27  7    3.241234  3
      2019  3 "20193"  0 27  8    9.145295  3
      2019  4 "20194"  0 27  9    7.471214  3
      2019  5 "20195"  0 27 10    5.354929  3
      2019  6 "20196"  0 27 11     2.42676  3
      2019  7 "20197"  0 27 12    5.298104  3
      2019  8 "20198"  0 27 13   2.3757844  3
      2019  9 "20199"  0 27 14    9.496355  3
      2020  1 "20201"  0 27 18    5.968487  3
      2020 10 "202010" 0 27 27   2.1778405  3
      2020 11 "202011" 0 27 28    9.300996  3
      2020 12 "202012" 0 27 29   3.3564036  3
      2020  2 "20202"  0 27 19    2.814975  3
      2020  3 "20203"  0 27 20    2.903293  3
      2020  4 "20204"  0 27 21    4.842035  3
      2020  5 "20205"  0 27 22   4.0251045  3
      2020  6 "20206"  0 27 23    8.111124  3
      2020  7 "20207"  0 27 24    1.374862  3
      2020  8 "20208"  0 27 25    7.263938  3
      2020  9 "20209"  0 27 26    8.219784  3
      2021  1 "20211"  0 27 30    4.933696  3
      2021  2 "20212"  0 27 31    6.391519  3
      2021  3 "20213"  0 27 32     7.70928  3
      2020  1 "20201"  0  9 18   1.6516296  4
      2020 10 "202010" 0  9 27    3.131789  4
      2020 11 "202011" 0  9 28    2.896417  4
      2020 12 "202012" 0  9 29    7.532889  4
      2020  2 "20202"  0  9 19    8.182489  4
      2020  3 "20203"  0  9 20     7.68029  4
      2020  4 "20204"  0  9 21    2.950384  4
      2020  5 "20205"  0  9 22    7.499077  4
      2020  6 "20206"  0  9 23   1.0585207  4
      2020  7 "20207"  0  9 24    8.960072  4
      2020  8 "20208"  0  9 25    5.990088  4
      2020  9 "20209"  0  9 26    7.187502  4
      2018 10 "201810" 0  9  3    5.763564  5
      2018 11 "201811" 0  9  4    3.144333  5
      2018 12 "201812" 0  9  5   4.1464753  5
      2018  8 "20188"  0  9  1   1.6662228  5
      2018  9 "20189"  0  9  2    7.416208  5
      2019  1 "20191"  0  9  6    .7370343  5
      2019 10 "201910" 0  9 15    4.953378  5
      2019 11 "201911" 0  9 16    8.671056  5
      2019 12 "201912" 0  9 17    8.441866  5
      2019  2 "20192"  0  9  7    6.772014  5
      2019  3 "20193"  0  9  8      2.9125  5
      2019  4 "20194"  0  9  9   2.1364968  5
      2019  5 "20195"  0  9 10    3.219365  5
      2019  6 "20196"  0  9 11    5.236912  5
      2019  7 "20197"  0  9 12    3.310858  5
      2019  8 "20198"  0  9 13    9.474156  5
      2019  9 "20199"  0  9 14    .1019091  5
      2020  1 "20201"  0  9 18     9.01666  5
      2020 10 "202010" 0  9 27    5.089784  5
      2020 11 "202011" 0  9 28   3.4462876  5
      2020 12 "202012" 0  9 29    .6595117  5
      2020  2 "20202"  0  9 19    8.809928  5
      2020  3 "20203"  0  9 20    2.636956  5
      2020  4 "20204"  0  9 21    6.032826  5
      2020  5 "20205"  0  9 22    9.485242  5
      2020  6 "20206"  0  9 23     7.61779  5
      2020  7 "20207"  0  9 24    9.101017  5
      2020  8 "20208"  0  9 25    .3709091  5
      2020  9 "20209"  0  9 26   2.0348547  5
      2021  1 "20211"  0  9 30   2.3807757  5
      2021  2 "20212"  0  9 31    2.590331  5
      2021  3 "20213"  0  9 32    7.111765  5
      2018 10 "201810" 0  9  3    5.752823  6
      2018 11 "201811" 0  9  4     5.80062  6
      2018 12 "201812" 0  9  5      6.2007  6
      2018  8 "20188"  0  9  1     5.21272  6
      2018  9 "20189"  0  9  2   2.9357924  6
      2019  1 "20191"  0  9  6     1.32492  6
      2019 10 "201910" 0  9 15    7.636866  6
      2019 11 "201911" 0  9 16   2.6273155  6
      2019 12 "201912" 0  9 17    .6142684  6
      2019  2 "20192"  0  9  7   2.9587605  6
      2019  3 "20193"  0  9  8     .803114  6
      2019  4 "20194"  0  9  9   4.4250474  6
      2019  5 "20195"  0  9 10    5.894524  6
      2019  6 "20196"  0  9 11    1.402627  6
      2019  7 "20197"  0  9 12    8.952939  6
      2019  8 "20198"  0  9 13    8.509423  6
      2019  9 "20199"  0  9 14    5.345918  6
      2020  1 "20201"  0  9 18    3.247553  6
      2020 10 "202010" 0  9 27    8.725818  6
      2020  2 "20202"  0  9 19    1.586611  6
      2020  3 "20203"  0  9 20    .7001554  6
      2020  4 "20204"  0  9 21   2.1862614  6
      2020  5 "20205"  0  9 22     1.72393  6
      2020  6 "20206"  0  9 23    4.814452  6
      2020  7 "20207"  0  9 24    9.822144  6
      2020  8 "20208"  0  9 25   3.6019285  6
      2020  9 "20209"  0  9 26    5.898798  6
      2018 10 "201810" 1 40  3   2.4476566  7
      2018 11 "201811" 1 40  4     7.90943  7
      2018 12 "201812" 1 40  5    1.333635  7
      2018  8 "20188"  1 40  1   3.4857955  7
      2018  9 "20189"  1 40  2    9.140632  7
      2019  1 "20191"  1 40  6    9.478208  7
      2019 10 "201910" 1 40 15    3.893855  7
      2019 11 "201911" 1 40 16    7.672158  7
      2019 12 "201912" 1 40 17     8.77275  7
      2019  2 "20192"  1 40  7   2.6259296  7
      2019  3 "20193"  1 40  8    9.531048  7
      2019  4 "20194"  1 40  9    1.588546  7
      2019  5 "20195"  1 40 10    6.790689  7
      2019  6 "20196"  1 40 11    7.126815  7
      2019  7 "20197"  1 40 12    2.458712  7
      2019  8 "20198"  1 40 13   1.6764313  7
      2019  9 "20199"  1 40 14    5.254681  7
      2020  1 "20201"  1 40 18    7.016855  7
      2020 10 "202010" 1 40 27   2.1484842  7
      2020 11 "202011" 1 40 28   2.1745336  7
      2020 12 "202012" 1 40 29    4.408948  7
      2020  2 "20202"  1 40 19   1.4903368  7
      2020  3 "20203"  1 40 20    6.821652  7
      2020  4 "20204"  1 40 21   2.0739052  7
      2020  5 "20205"  1 40 22    4.953641  7
      2020  6 "20206"  1 40 23    .2307996  7
      2020  7 "20207"  1 40 24    2.977416  7
      2020  8 "20208"  1 40 25    5.949654  7
      2020  9 "20209"  1 40 26    3.944947  7
      2021  1 "20211"  1 40 30    6.177876  7
      2021  2 "20212"  1 40 31   4.6472473  7
      2021  3 "20213"  1 40 32    5.234149  7
      2018 10 "201810" 0 25  3    8.329607  8
      2018 11 "201811" 0 25  4    3.899847  8
      2018 12 "201812" 0 25  5    9.370722  8
      2018  8 "20188"  0 25  1    9.354629  8
      2018  9 "20189"  0 25  2    3.017852  8
      2019  1 "20191"  0 25  6    8.485166  8
      2019 10 "201910" 0 25 15    5.164359  8
      2019 11 "201911" 0 25 16    7.660375  8
      2019 12 "201912" 0 25 17   .06122523  8
      2019  2 "20192"  0 25  7    9.302339  8
      2019  3 "20193"  0 25  8   3.7246194  8
      2019  4 "20194"  0 25  9    .4260934  8
      2019  5 "20195"  0 25 10   2.1328244  8
      2019  6 "20196"  0 25 11    9.883374  8
      2019  7 "20197"  0 25 12    8.072899  8
      2019  8 "20198"  0 25 13    5.263667  8
      2019  9 "20199"  0 25 14    1.667525  8
      2020  1 "20201"  0 25 18    1.230856  8
      2020 10 "202010" 0 25 27    9.841234  8
      2020 11 "202011" 0 25 28    2.145945  8
      2020  2 "20202"  0 25 19   4.6190553  8
      2020  3 "20203"  0 25 20   1.4640977  8
      2020  4 "20204"  0 25 21    5.176486  8
      2020  5 "20205"  0 25 22    5.716005  8
      2020  6 "20206"  0 25 23    8.191779  8
      2020  7 "20207"  0 25 24    5.814484  8
      2020  8 "20208"  0 25 25    4.054936  8
      2020  9 "20209"  0 25 26    6.696227  8
      2018 10 "201810" 0  9  3    4.838048  9
      2018 11 "201811" 0  9  4   2.0370777  9
      2018 12 "201812" 0  9  5   1.4334027  9
      2018  8 "20188"  0  9  1    9.695601  9
      2018  9 "20189"  0  9  2    7.663661  9
      2019  1 "20191"  0  9  6    1.653828  9
      2019 10 "201910" 0  9 15    7.076856  9
      2019 11 "201911" 0  9 16     1.19275  9
      2019 12 "201912" 0  9 17    9.374759  9
      2019  2 "20192"  0  9  7    6.847514  9
      2019  3 "20193"  0  9  8    7.272093  9
      2019  4 "20194"  0  9  9    9.466451  9
      2019  5 "20195"  0  9 10    3.423412  9
      2019  6 "20196"  0  9 11    9.084236  9
      2019  7 "20197"  0  9 12    1.903814  9
      2019  8 "20198"  0  9 13    6.374664  9
      2019  9 "20199"  0  9 14    6.005998  9
      2020  1 "20201"  0  9 18    6.326343  9
      2020 10 "202010" 0  9 27    3.984069  9
      2020 11 "202011" 0  9 28    3.718146  9
      2020 12 "202012" 0  9 29   3.7028346  9
      2020  2 "20202"  0  9 19    3.986612  9
      2020  3 "20203"  0  9 20    5.590534  9
      2020  4 "20204"  0  9 21    5.770776  9
      2020  5 "20205"  0  9 22    7.937202  9
      2020  6 "20206"  0  9 23    6.875431  9
      2020  7 "20207"  0  9 24    4.880559  9
      2020  8 "20208"  0  9 25   1.0597852  9
      2020  9 "20209"  0  9 26     4.76765  9
      2021  1 "20211"  0  9 30    2.818333  9
      2021  2 "20212"  0  9 31    6.244217  9
      2021  3 "20213"  0  9 32    1.474202  9
      2018 10 "201810" 1 40  3   1.8761444 10
      2018 11 "201811" 1 40  4    9.124126 10
      2018 12 "201812" 1 40  5    7.891165 10
      2018  8 "20188"  1 40  1    7.420677 10
      2018  9 "20189"  1 40  2    9.274618 10
      2019  1 "20191"  1 40  6    1.951128 10
      2019 10 "201910" 1 40 15    8.287621 10
      2019 11 "201911" 1 40 16    8.444612 10
      2019 12 "201912" 1 40 17    7.288074 10
      2019  2 "20192"  1 40  7    8.471776 10
      2019  3 "20193"  1 40  8    6.797028 10
      2019  4 "20194"  1 40  9   2.8162744 10
      2019  5 "20195"  1 40 10    7.250293 10
      2019  6 "20196"  1 40 11    5.429574 10
      2019  7 "20197"  1 40 12    8.038015 10
      2019  8 "20198"  1 40 13     4.77181 10
      2019  9 "20199"  1 40 14    .7238613 10
      2020  1 "20201"  1 40 18    9.080024 10
      2020 10 "202010" 1 40 27    8.216396 10
      2020 11 "202011" 1 40 28   1.2984966 10
      2020 12 "202012" 1 40 29    7.165498 10
      2020  2 "20202"  1 40 19   1.4105202 10
      2020  3 "20203"  1 40 20   3.5067585 10
      2020  4 "20204"  1 40 21     2.53459 10
      2020  5 "20205"  1 40 22     5.98816 10
      2020  6 "20206"  1 40 23   2.1863124 10
      2020  7 "20207"  1 40 24   2.9850426 10
      2020  8 "20208"  1 40 25    8.613802 10
      2020  9 "20209"  1 40 26    8.974747 10
      2021  1 "20211"  1 40 30   4.1742578 10
      2021  2 "20212"  1 40 31    3.761248 10
      2021  3 "20213"  1 40 32      .67303 10
      2018 10 "201810" 0  9  3    5.859678 11
      2018 11 "201811" 0  9  4    4.961307 11
      2018 12 "201812" 0  9  5    .1814808 11
      2018  8 "20188"  0  9  1    8.835435 11
      2018  9 "20189"  0  9  2   1.2851697 11
      2019  1 "20191"  0  9  6    4.824552 11
      2019 10 "201910" 0  9 15    8.475065 11
      2019 11 "201911" 0  9 16    5.527618 11
      2019 12 "201912" 0  9 17    6.710842 11
      2019  2 "20192"  0  9  7     2.71026 11
      2019  3 "20193"  0  9  8     3.72781 11
      2019  4 "20194"  0  9  9    4.904513 11
      2019  5 "20195"  0  9 10    8.252763 11
      2019  6 "20196"  0  9 11    8.414296 11
      2019  7 "20197"  0  9 12    6.412801 11
      2019  8 "20198"  0  9 13    8.180822 11
      2019  9 "20199"  0  9 14    .7455062 11
      2018 10 "201810" 1 40  3    5.937301 12
      2018 11 "201811" 1 40  4   3.4150515 12
      2018 12 "201812" 1 40  5   2.3472867 12
      2018  8 "20188"  1 40  1   2.3324742 12
      2018  9 "20189"  1 40  2     6.59022 12
      2019  1 "20191"  1 40  6    1.375673 12
      2019 10 "201910" 1 40 15    3.866729 12
      2019 11 "201911" 1 40 16    5.482247 12
      2019 12 "201912" 1 40 17    6.148804 12
      2019  2 "20192"  1 40  7    3.259921 12
      2019  3 "20193"  1 40  8     1.98041 12
      2019  4 "20194"  1 40  9    3.212341 12
      2019  5 "20195"  1 40 10    .9074852 12
      2019  6 "20196"  1 40 11    5.740378 12
      2019  7 "20197"  1 40 12    7.293422 12
      2019  8 "20198"  1 40 13   .08754096 12
      2019  9 "20199"  1 40 14    7.502211 12
      2020  1 "20201"  1 40 18    7.160038 12
      2020 10 "202010" 1 40 27    8.560918 12
      2020 11 "202011" 1 40 28   4.4149003 12
      2020 12 "202012" 1 40 29    3.793423 12
      2020  2 "20202"  1 40 19    6.899609 12
      2020  3 "20203"  1 40 20   .12535164 12
      2020  4 "20204"  1 40 21    3.556548 12
      2020  5 "20205"  1 40 22    .7354485 12
      2020  6 "20206"  1 40 23    6.138276 12
      2020  7 "20207"  1 40 24    9.744926 12
      2020  8 "20208"  1 40 25     1.35516 12
      2020  9 "20209"  1 40 26   1.4342084 12
      2021  1 "20211"  1 40 30 .0003548431 12
      2021  2 "20212"  1 40 31   1.1851813 12
      2021  3 "20213"  1 40 32    4.925122 12
      2018 10 "201810" 0  1  3    8.163175 13
      2018 11 "201811" 0  1  4     7.39435 13
      2018 12 "201812" 0  1  5    4.116225 13
      2018  8 "20188"  0  1  1    6.186018 13
      2018  9 "20189"  0  1  2    .6203403 13
      2018 10 "201810" 1 40  3    8.165086 14
      2018 11 "201811" 1 40  4   4.4563217 14
      2018 12 "201812" 1 40  5    3.655759 14
      2018  8 "20188"  1 40  1     8.88096 14
      2018  9 "20189"  1 40  2   10.000744 14
      2019  1 "20191"  1 40  6   1.9739002 14
      2019 10 "201910" 1 40 15    3.683996 14
      2019 11 "201911" 1 40 16   1.2756222 14
      2019 12 "201912" 1 40 17     6.41056 14
      2019  2 "20192"  1 40  7    4.590661 14
      2019  3 "20193"  1 40  8   10.084952 14
      2019  4 "20194"  1 40  9    1.563199 14
      2019  5 "20195"  1 40 10    8.275483 14
      2019  6 "20196"  1 40 11    1.388385 14
      2019  7 "20197"  1 40 12   2.3186655 14
      2019  8 "20198"  1 40 13    8.641288 14
      2019  9 "20199"  1 40 14    .9660628 14
      2020  1 "20201"  1 40 18     8.20918 14
      2020 10 "202010" 1 40 27    6.739127 14
      2020 11 "202011" 1 40 28   10.300123 14
      2020 12 "202012" 1 40 29      8.2985 14
      2020  2 "20202"  1 40 19   3.1088755 14
      2020  3 "20203"  1 40 20    7.193382 14
      2020  4 "20204"  1 40 21    8.936744 14
      2020  5 "20205"  1 40 22    5.845172 14
      2020  6 "20206"  1 40 23   3.1618774 14
      2020  7 "20207"  1 40 24   4.6240706 14
      2020  8 "20208"  1 40 25     2.52147 14
      2020  9 "20209"  1 40 26    9.555015 14
      2021  1 "20211"  1 40 30    7.612161 14
      2021  2 "20212"  1 40 31    6.726914 14
      2021  3 "20213"  1 40 32    6.500872 14
      2018 10 "201810" 0  9  3   2.3815832 15
      2018 11 "201811" 0  9  4   2.0368853 15
      2018 12 "201812" 0  9  5   .12240066 15
      2018  8 "20188"  0  9  1    8.829661 15
      2018  9 "20189"  0  9  2   1.4159802 15
      2019  1 "20191"  0  9  6    1.362707 15
      2019 10 "201910" 0  9 15    6.133142 15
      2019 11 "201911" 0  9 16   8.6155615 15
      2019 12 "201912" 0  9 17    2.831199 15
      2019  2 "20192"  0  9  7   4.6036143 15
      2019  3 "20193"  0  9  8   3.3924725 15
      2019  4 "20194"  0  9  9    .5149167 15
      2019  5 "20195"  0  9 10     4.37327 15
      2019  6 "20196"  0  9 11    6.132393 15
      2019  7 "20197"  0  9 12   3.1126904 15
      2019  8 "20198"  0  9 13   2.8333704 15
      2019  9 "20199"  0  9 14    1.217176 15
      2020  1 "20201"  0  9 18     6.31824 15
      2020 10 "202010" 0  9 27    6.232001 15
      2020 11 "202011" 0  9 28    9.476906 15
      2020 12 "202012" 0  9 29    9.441483 15
      2020  2 "20202"  0  9 19    9.505275 15
      2020  3 "20203"  0  9 20     6.79731 15
      2020  4 "20204"  0  9 21   1.5790466 15
      2020  5 "20205"  0  9 22     9.27956 15
      2020  6 "20206"  0  9 23    8.533494 15
      2020  7 "20207"  0  9 24     6.83346 15
      2020  8 "20208"  0  9 25   2.9076855 15
      2020  9 "20209"  0  9 26   3.9247525 15
      2021  1 "20211"  0  9 30    7.703138 15
      2018 10 "201810" 0  9  3    9.065013 16
      2018 11 "201811" 0  9  4    3.171321 16
      2018 12 "201812" 0  9  5   1.9748538 16
      2018  8 "20188"  0  9  1   3.7073326 16
      2018  9 "20189"  0  9  2   2.2483292 16
      2019  1 "20191"  0  9  6   4.3794627 16
      2019 10 "201910" 0  9 15    2.896263 16
      2019 11 "201911" 0  9 16   1.1547415 16
      2019 12 "201912" 0  9 17   2.1316648 16
      2019  2 "20192"  0  9  7    1.761142 16
      2019  3 "20193"  0  9  8    7.313239 16
      2019  4 "20194"  0  9  9    2.977915 16
      2019  5 "20195"  0  9 10    5.930423 16
      2019  6 "20196"  0  9 11    9.326112 16
      2019  7 "20197"  0  9 12    8.137642 16
      2019  8 "20198"  0  9 13    8.925205 16
      2019  9 "20199"  0  9 14   1.4414163 16
      2020  1 "20201"  0  9 18    3.719126 16
      2020 10 "202010" 0  9 27     7.73646 16
      2020 11 "202011" 0  9 28     4.09581 16
      2020 12 "202012" 0  9 29    6.047992 16
      2020  2 "20202"  0  9 19    9.394392 16
      2020  3 "20203"  0  9 20    7.183547 16
      2020  4 "20204"  0  9 21   4.0604196 16
      2020  5 "20205"  0  9 22   3.9876864 16
      2020  6 "20206"  0  9 23     .031765 16
      2020  7 "20207"  0  9 24    9.062113 16
      2020  8 "20208"  0  9 25    6.979237 16
      2020  9 "20209"  0  9 26   3.7387085 16
      2021  1 "20211"  0  9 30    5.063859 16
      2021  2 "20212"  0  9 31    6.030518 16
      2021  3 "20213"  0  9 32    .7819452 16
      2018 10 "201810" 0  9  3     2.04127 17
      2018 11 "201811" 0  9  4    8.617164 17
      2018 12 "201812" 0  9  5    3.062447 17
      2018  8 "20188"  0  9  1    7.177741 17
      2018  9 "20189"  0  9  2    8.005289 17
      2019  1 "20191"  0  9  6   2.7469206 17
      2019 10 "201910" 0  9 15   4.2824583 17
      2019 11 "201911" 0  9 16    6.691942 17
      2019 12 "201912" 0  9 17    7.400893 17
      2019  2 "20192"  0  9  7   2.6358685 17
      2019  3 "20193"  0  9  8   4.0461287 17
      2019  4 "20194"  0  9  9    8.169775 17
      2019  5 "20195"  0  9 10    5.613908 17
      2019  6 "20196"  0  9 11    5.340521 17
      2019  7 "20197"  0  9 12    7.046791 17
      2019  8 "20198"  0  9 13    4.366727 17
      2019  9 "20199"  0  9 14    9.483538 17
      2020  1 "20201"  0  9 18   .54515773 17
      2020 10 "202010" 0  9 27    3.545572 17
      2020 11 "202011" 0  9 28    6.890961 17
      2020 12 "202012" 0  9 29    3.288022 17
      2020  2 "20202"  0  9 19    8.896478 17
      2020  3 "20203"  0  9 20    8.710363 17
      2020  4 "20204"  0  9 21    6.760664 17
      2020  5 "20205"  0  9 22    .9503378 17
      2020  6 "20206"  0  9 23    3.917658 17
      2020  7 "20207"  0  9 24    .3847771 17
      2020  8 "20208"  0  9 25    4.808871 17
      2020  9 "20209"  0  9 26    8.225313 17
      2021  1 "20211"  0  9 30    1.518843 17
      2021  2 "20212"  0  9 31    3.944212 17
      2021  3 "20213"  0  9 32    2.955542 17
      2018 10 "201810" 0  1  3    2.496096 18
      2018 11 "201811" 0  1  4    6.492787 18
      2018 12 "201812" 0  1  5    2.845662 18
      2018  8 "20188"  0  1  1   .19175343 18
      2018  9 "20189"  0  1  2   3.0073586 18
      2019  1 "20191"  0  1  6    9.549002 18
      2019 10 "201910" 0  1 15    6.863246 18
      2019 11 "201911" 0  1 16    7.690255 18
      2019 12 "201912" 0  1 17    3.735141 18
      2019  2 "20192"  0  1  7    8.168134 18
      2019  3 "20193"  0  1  8   1.2520688 18
      2019  4 "20194"  0  1  9    9.686743 18
      2019  5 "20195"  0  1 10    7.859705 18
      2019  6 "20196"  0  1 11    .5949351 18
      2019  7 "20197"  0  1 12    7.013388 18
      2019  8 "20198"  0  1 13   1.1217903 18
      2019  9 "20199"  0  1 14    4.905401 18
      2020  1 "20201"  0  1 18    7.073771 18
      2020  2 "20202"  0  1 19    9.595904 18
      2020  3 "20203"  0  1 20    6.536124 18
      2020  4 "20204"  0  1 21    7.226632 18
      2020  5 "20205"  0  1 22    .3510576 18
      2018 10 "201810" 0  1  3    4.654211 19
      2018 11 "201811" 0  1  4   4.6256423 19
      2018 12 "201812" 0  1  5    8.653395 19
      2018  8 "20188"  0  1  1    3.642115 19
      2018  9 "20189"  0  1  2    8.923897 19
      2019  1 "20191"  0  1  6    7.591852 19
      2019  2 "20192"  0  1  7    6.418539 19
      2019  3 "20193"  0  1  8    1.686367 19
      2019  4 "20194"  0  1  9    2.860294 19
      2019  5 "20195"  0  1 10    5.917571 19
      2018 10 "201810" 0  9  3    5.402507 20
      2018 11 "201811" 0  9  4    5.671078 20
      2018 12 "201812" 0  9  5   4.5595655 20
      2018  8 "20188"  0  9  1    7.704699 20
      2018  9 "20189"  0  9  2    .8245859 20
      2019  1 "20191"  0  9  6    5.945876 20
      2019 10 "201910" 0  9 15   1.7850147 20
      2019 11 "201911" 0  9 16    2.887656 20
      2019 12 "201912" 0  9 17   2.3033497 20
      2019  2 "20192"  0  9  7    6.264809 20
      2019  3 "20193"  0  9  8    2.724624 20
      2019  4 "20194"  0  9  9     6.62279 20
      2019  5 "20195"  0  9 10    6.323635 20
      2019  6 "20196"  0  9 11    6.049952 20
      2019  7 "20197"  0  9 12  -.13420914 20
      2019  8 "20198"  0  9 13    2.954927 20
      2019  9 "20199"  0  9 14   2.4882104 20
      2020  1 "20201"  0  9 18    6.458018 20
      2020 10 "202010" 0  9 27    5.261304 20
      2020 11 "202011" 0  9 28    5.965877 20
      end

      Comment


      • #4
        Interesting problem. I'm reviewing a paper right now that does something similar, so I'm curious as to the answer.

        It appears it has something to do with both the absorbed slopes and the imbalanced sample.

        I cleaned up your date code.

        Code:
        gen date = ym(year, month)
        format %tm date
        xtset id date
        
        * first shock (2019.8-2020.3)
        g post = tin(2019m8, 2020m3)
        * second shock (2020.4-2021-3)
        g post2 = tin(2020m4,2021m3)
        
        gen treat_post = treat * post
        gen treat_post2 = treat * post2
        sort year month
        
        * generate time dummies
        tabulate year_month_c, generate(t)
        sort year month
        
        * interact time dummies with the treatment variable for months in the post period
        foreach var of varlist t13-t32{
            gen `var'_treat = `var'*treat
        }
        
        egen Nid = count(id), by(id)
        tab Nid
        
        ** Balanced, No Slopes
        reghdfe y c.treat#c.post c.treat#c.post2 if Nid==32, a(ind3_code date) cluster(ind3_code)
        qui reghdfe y t13_treat  - t32_treat if Nid==32, a(ind3_code date) cluster(ind3_code)
        lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8
        
        ** Balanced, Add Slopes
        reghdfe y c.treat#c.post c.treat#c.post2 if Nid==32, a(ind3_code date i.ind3_code#c.date) cluster(ind3_code)
        reghdfe y t13_treat  - t32_treat if Nid==32, a(ind3_code date i.ind3_code#c.date) cluster(ind3_code)
        lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8
        
        ** Allow imbalanced, no slopes
        reghdfe y c.treat#c.post c.treat#c.post2, a(ind3_code date) cluster(ind3_code)
        qui reghdfe y t13_treat  - t32_treat, a(ind3_code date) cluster(ind3_code)
        tabstat t13-t20 if e(sample) , save stats(mean sum) format(%8.4f)
        lincom (t13*0.034 + t14*0.034 + t15*0.032 + t16*0.032 + t17*0.032 + t18*0.032 + t19*0.03 + t20*0.03)/0.256
        
        ** A little unbalanced
        reghdfe y c.treat#c.post c.treat#c.post2 if Nid>=30, a(ind3_code date) cluster(ind3_code)
        qui reghdfe y t13_treat  - t32_treat if Nid>=30, a(ind3_code date) cluster(ind3_code)
        tabstat t13-t20 if e(sample) , save stats(mean sum) format(%8.4f)
        lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8
        
        ** More imbalanced
        reghdfe y c.treat#c.post c.treat#c.post2 if Nid>=27, a(ind3_code date) cluster(ind3_code)
        qui reghdfe y t13_treat  - t32_treat if Nid>=27, a(ind3_code date) cluster(ind3_code)
        tabstat t13-t20 if e(sample) , save stats(mean sum) format(%8.4f)
        lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8

        Comment


        • #5
          Same with id date

          Code:
          reghdfe y c.treat#c.post c.treat#c.post2 if Nid==32, a(id date) 
          qui reghdfe y t13_treat - t32_treat if Nid==32, a(id date)
          lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8
          
          reghdfe y c.treat#c.post c.treat#c.post2 if Nid==32, a(id date i.id#c.date) 
          reghdfe y t13_treat - t32_treat if Nid==32, a(id date i.id#c.date)
          lincom (t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20)/8

          Comment


          • #6
            I expect that the coefficient on "treat_post" will be approximately equal to the weighted average of the coefficients on the variables from t13_treat to t20_treat, and the coefficient on treat_post2 will be approximately equal to the weighted average of the coefficients on the variables from t21_treat to t32_treat.
            No, this expectation is incorrect. It is simply untrue that, in general, the coefficient of x in a regression will be some weighted average of the coefficients of x in regressions conditioned on the value of some other variable.

            Here is a simple (simplistic) example showing this:
            Code:
            clear*
            
            set obs 100
            gen x = _n
            gen group = x <= 50
            set seed 1234
            gen y = 0.1*x + rnormal()
            replace y = 0.01*x + rnormal() + 25 if group
            
            regress y x
            regress y c.x##i.group
            margins group, dydx(x)
            
            graph twoway lfit y x || lfit y x if group || lfit y x if !group || scatter y x
            The graph makes it clear exactly what is going on here. In your data the situation is probably not so stark. But the principle remains: the regression coefficient of x in the full data does not even have to fall within the range of the coefficients conditional on values of other variables, or even have the same sign.

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              No, this expectation is incorrect. It is simply untrue that, in general, the coefficient of x in a regression will be some weighted average of the coefficients of x in regressions conditioned on the value of some other variable.
              Hi Clyde, thank you for the reply and the example! I understand that it is not true that the coefficient of x in a regression will be some weighted average of the coefficients of x in regressions conditioned on the value of some other variable, and your example clearly illustrates the point.

              But I think my question is different. I was trying the compare the coefficients on Treat*Post and the coefficients on Treat*T1, Treat*T2,...., Treat*Tn. T1, T2,...,Tn are dummy variables indicating the relevant period, and "Post" is set to 1 for periods from T1 to Tn (i.e. Post = T1+T2+T3...+Tn).

              I wonder if in this case, the coefficient on Treat*Post will be the weighted average of the coefficients on Treat*T1, Treat*T2,...,Treat*Tn.

              Thank you.

              Comment


              • #8
                No, it's not actually a different thing. Consider just the regression on the data during the Post period. Then Treat*Post is just the coefficient of Treat during the Post period minus the coefficient of Treat during the Pre period, and Treat*Ti is the coefficient of Treat in year Ti minus the coefficient in the Pre period. But the post period consists of precisely the Ti years. So this is just like the example I showed with Ti representing group and Treat representing X.

                Added: I do note, however, that for this kind of situation to arise there must be a correlation between X and group. If X and group are independent, this could not happen. So, if you had a data set where the panels are all balanced, and where all the panels underwent treatment at the same time, then Treat would be independent of year, and your expectation would be correct. But your data is not like that.
                Last edited by Clyde Schechter; 22 Aug 2024, 16:54.

                Comment


                • #9
                  No, it's not actually a different thing. Consider just the regression on the data during the Post period. Then Treat*Post is just the coefficient of Treat during the Post period minus the coefficient of Treat during the Pre period, and Treat*Ti is the coefficient of Treat in year Ti minus the coefficient in the Pre period. But the post period consists of precisely the Ti years. So this is just like the example I showed with Ti representing group and Treat representing X.

                  Added: I do note, however, that for this kind of situation to arise there must be a correlation between X and group. If X and group are independent, this could not happen. So, if you had a data set where the panels are all balanced, and where all the panels underwent treatment at the same time, then Treat would be independent of year, and your expectation would be correct. But your data is not like that.
                  hi Clyde, thank you for the further explanation. I see now why they are the same thing.

                  Originally posted by George Ford View Post
                  Interesting problem. I'm reviewing a paper right now that does something similar, so I'm curious as to the answer.

                  It appears it has something to do with both the absorbed slopes and the imbalanced sample.

                  I cleaned up your date code.
                  Thank you George for the code and the examples, they are very helpful.


                  To summarize the replies so far, the problem arises because of the imbalanced sample I have.
                  It also has something to do with the absorbed linear time trends (i.ind3_code#c.date), because it arises even in a balanced sample (and all panels underwent treatment at the same time) when the slopes are absorbed. But the reason is not clear.

                  Comment


                  • #10
                    Thanks Clyde for jumping in.

                    Comment

                    Working...
                    X