Announcement

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

  • Before and after treament.

    I have a dataset with 5 variables named sid, year, c, EBITDA and IN. I want to see what effect treatment (c) has on EBITDA and have for that matter calculated EBITDA three years before and three years after treatment (c). I need some help running a regression analysis on before and after treatment, and year of the treatment (c) for each company should be excluded from the analysis. I would also like to see if the effect of the treatment is different when IN = 1 compared to IN = 0. If anyone could help me with this it would be much appreciated. If you need some more information just let me know.

    sid = company id
    year = what year
    c = 1 = year of treatment
    EBITDA is a variable for profitability
    IN = 1 if the company has an international owner.

    This is an example of how the dataset looks:
    Code:
    * Dataset created by -data-ex. To install: ssc install data
    clear
    input float(sid year c EBITDA IN)
    1 2000 0  75 0
    1 2001 0  80 0
    1 2002 0  85 0
    1 2003 1  70 1
    1 2004 0  85 1
    1 2005 0  110 1
    1 2006 0  130 1
    2 2004 0  10 0
    2 2005 0  15 0
    2 2006 0  15 0
    2 2007 1 5 0
    2 2008 0 15 0
    2 2009 0 25 0
    2 2010 0 40 0
    3 2009 0 133 0
    3 2010 0 143 0
    3 2011 0 153 0
    3 2012 1 110 1
    3 2013 0 130 1
    3 2014 0 170 1
    3 2015 0 180 1
    end
    Code:
    . list, sepby(sid)
    
         +-------------------------------------+
         | sid   year   c   EBITDA       IN |
         |-------------------------------------|
      1. |   1   2000   0       75        0 |
      2. |   1   2001   0       80        0 |
      3. |   1   2002   0       85        0 |
      4. |   1   2003   1       70        1 |
      5. |   1   2004   0       85        1 |
      6. |   1   2005   0      110        1 |
      7. |   1   2006   0      130        1 |
         |-------------------------------------|
      8. |   2   2004   0       10        0 |
      9. |   2   2005   0       15        0 |
     10. |   2   2006   0       15        0 |
     11. |   2   2007   1        5        0 |
     12. |   2   2008   0       15        0 |
     13. |   2   2009   0       25        0 |
     14. |   2   2010   0       40        0 |
         |-------------------------------------|
     15. |   3   2009   0      133        0 |
     16. |   3   2010   0      143        0 |
     17. |   3   2011   0      153        0 |
     18. |   3   2012   1      110        1 |
     19. |   3   2013   0      130        1 |
     20. |   3   2014   0      170        1 |
     21. |   3   2015   0      180        1 |
         +-------------------------------------+
    end
    Thanks in advance,
    Heath

  • #2
    Here is how I would approach this:
    Code:
    xtset sid year
    
    //    IDENTIFY PRE-POST YEARS
    label define pre_post    0    "Before"    1    "After"
    by sid (year), sort: gen pre_post:pre_post = sum(c)
    
    //    EXCLUDE YEAR OF TREATMENT
    drop if c
    
    //    ESTIMATE EFFECT OF PRE_POST ON EBITDA, ALLOWING FOR
    //    POSSIBLE DEPENDENCE OF EFFECT ON VALUE OF IN
    xtreg EBITDA i.pre_post##i.IN, fe
    margins, dydx(pre_post) // AVERAGE MARGINAL EFFECT
    margins pre_post#IN // IN-SPECIFIC MARGINAL EFFECTS
    margins IN, dydx(pre_post)
    Now, this will not actually work in your example. Your example data does not contain any before-treatment data for observations where IN == 1. But I assume that is not true in your full data set. (If it is true in your full data set then you cannot answer the question about whether IN modifies the effect from this data.)

    Comment


    • #3
      Hi, thanks for the quick reply and good answer.

      Code:
      Random-effects GLS regression        Number of obs     =    53,202
      Group variable: sid        Number of groups  =    12,345
      
      R-sq:        Obs per group:
      within  = 0.0160        min =    1
      between = 0.0003        avg =    4.3
      overall = 0.0023        max =    12
      
              Wald chi2(4)      =    634.35
      corr(u_i, X)   = 0 (assumed)        Prob > chi2       =    0.0000
      
                  
      ebitda_ln       Coef.   Std. Err.    z    P>z     [95% Conf.    Interval]
      ----------------------------------------------------------------------------------           
      pre_post
      After     .2185037   .0089394    24.44    0.000     .2009827    .2360246
      2         .3959405   .0455096    8.70    0.000     .3067432    .4851377
      3         .7710211   .4116675    1.87    0.061    -.0358323    1.577874
      ----------------------------------------------------------------------------------
      This is not a technical question, but hopefully you can give me an answer anyway. Does "After" mean year 1 after the treatment? And how do i change the name of "After", "2" and "3" to something of my choice?

      Comment


      • #4
        Clyde already pointed to an answer. His code included

        Code:
         
         label define pre_post    0    "Before"    1    "After"
        So, if you want different names you can go

        Code:
         
         label define pre_post    0    "Before"    1    "Whatever"   2 "you"   3 "want", modify

        Comment

        Working...
        X