Announcement

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

  • Estat Trendplot Problem of Varying Treatment Assignment Times

    Dear Stata Community

    This is my second post here in the forum and my first one that includes code. I hope I am providing it in the right format, if not I do apologize for the inconvenience!
    As I am very new to Stata I would be glad for any help.
    I am trying to do a DiD regression using the xtdidregress command. I also want to include a graphical diagnostics for parallel trends with the estat trendplot command. Unfortunately, Stata tells me that my treatment assignment times vary, thus, it is not possible to create a trendplot. Here my questions:
    (1) Is there any possibility to see for which observations my treatment assignment time is different (it shouldn't be many)
    (2) Is there any possibility to then exclude these observations because it shouldn't be many
    (3) Is there any possibility to do a trendplot with varying times of treatment assignment? I haven't found anything so far.


    Treatment occurs in 2012 for all companies (identified with gvkey) which have >= 100 sale. I have inserted some example from my data. As I am really very new to Stata I might also have already made a mistake when coding the binary treatment indicator.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long gvkey int fyear double(sale prcc_f) float(ROE lnAT xttreat)
    1161 2010     6494  8.18   .4856861 8.509967 0
    1161 2011     6568   5.4  .31132075 8.507951 0
    1161 2012     5422   2.4  .05762082 8.294049 1
    1161 2013     5299  3.87     .15625 8.374938 1
    1161 2014     5506  2.67   .7967914 8.234035 1
    1327 2010 1071.849 20.67  .15092254 7.355035 0
    1327 2011 1418.922 17.96  .19203404 7.544538 0
    1327 2012 1568.581 23.56  .14634672 7.666993 1
    1327 2013     1792 24.84   .1682928 7.754953 1
    1327 2014   2291.5 58.05   .2255568 7.997596 1
    1585 2010   229.62  8.54  .11530489 5.641194 0
    1585 2011  304.429 13.34   .1944118 5.826416 0
    1585 2012   366.19 31.07  .26272786 5.991189 1
    1585 2013  381.021 24.29  .21492675 6.103549 1
    1585 2014  298.634 11.62 .021999946 6.159457 1
    end
    format %ty fyear
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long gvkey int fyear double(sale prcc_f) float(ROE lnAT xttreat)
    5327 2010  17.262 .3601  -1.2696234  2.373975 0
    5327 2011  15.904 .1999   -.6402786 2.3977134 0
    5327 2012  16.738   .17    .4055336  2.360382 0
    5327 2013  19.218   .55    .5960841 2.4830716 0
    5327 2014  21.995   .92    .6509488  2.492296 0
    6003 2010 625.705 7.375   .09837637  6.589559 0
    6003 2011 526.696  7.15   .04580489   6.57596 0
    6003 2012 487.236  7.47 -.006794957  6.591096 1
    6003 2013 484.779 12.23   .06117421  6.722582 1
    6003 2014 572.905 20.02   .14619653  6.817457 1
    6109 2010 895.297 18.61  .009418815  7.273035 0
    end
    format %ty fyear

    Code:
    xtset gvkey fyear, yearly
    Code:
    xtdidregress (prcc_f  ROE lnAT ) (xttreat),  group(gvkey) time(fyear)
    Code:
    estat trendplot
    Thank you for your help! I am looking forward to hearing from you!

    Best regards
    Franziska

  • #2
    Hello,
    It's me again...
    I have further thought about how to find out for which observation treatment assignment times vary.
    My panel is balanced from 2010-2014. Treatment occurs in 2012. I thought I could count the number of periods the treatment indicator (xttreat) is 1. If my result is 3, I thought I could infer that Treatment happens in 2012, 2013, 2014.
    Code:
    by gvkey, sort: egen n_obs = total(xttreat)
    When tabulating n_obs I see that I only have 0 or 3 as values. Thus, I would conclude that my treatment assignment time should not vary... However, I am still not able to do estat trendplot since Stata tells me that my treatment assignment times vary. I don't know what to do now... I must make a mistake but I don't know how to figure out what goes wrong.


    n_obs | Freq. Percent Cum.
    ------------+-----------------------------------
    0 | 740 44.98 44.98
    3 | 905 55.02 100.00
    ------------+-----------------------------------
    Total | 1,645 100.00

    Best regards and thank you for your help!
    Franziska

    Comment


    • #3
      Hi Franziska Buchner , did you find out how to solve this issue? I suffering the same pain! Thank you!

      Comment

      Working...
      X