Announcement

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

  • linear Regression with treatment and control variables

    Dear all,

    I am interested to study the impact of monetary policy changes on the stock market return over the last 20 years.

    the list of my variables for linear regression in an event study model is:
    date event date DAX index Conventional surprise pre-crisis Expected change crisis Expected change pre-crisis Conventional surprise crisis MSCI world index crisis
    1990/01/01 1 100 0
    ... 0 101 0
    2020/12/30 0 102 1

    1- "return of the DAX index" as my dependent variable;
    2- "event dates or policy announcement dates" as the treatment variable which takes 1 when the event occurs in total 272 events;
    3- "MSCI world index" and "crisis dummy" as The vector of control variables;
    4- "Conventional surprise pre-crisis", "Expected change pre-crisis", Conventional surprise crisis", "Expected change crisis" as my independent variables.

    my model:

    return of the DAX index = constant + Conventional surprise pre-crisis + Expected change pre-crisis + Conventional surprise crisis + Expected change crisis + The vector of control variables+ residual

    I was recommended to use "bacondecomp module" which shows a Bacon decomposition of difference-in-differences estimation with variation in treatment timing. The two-way fixed effects DD model is a weighted average of all possible two-group/two-period DD estimators. The command generates a scatterplot of 2x2 difference-in-difference estimates and their associated weights. The data must be xtset and the variable list must include an outcome as the first item, and a treatment that can only turn from zero to one during the time period examined as its second item.https://ideas.repec.org/c/boc/bocode/s458676.html

    my question is that how can I use xtset data structure? because I don't have a factor variable that has different categories within the variable (like company1, comapy2, campany3, ...). my data is a time series for all of my variables and my dependent variable is just the return of the DAX index value (times series).

    can someone please help me with this question?

    thank you so much,
    Shahrzad

  • #2
    I've not heard of the Bacon decomposition, but from what you describe you might want to check out the community-contributed command eventdd (available from SSC). I would take a look at the authors' paper (linked below). Hope this helps.

    Here's a silly illustration

    Code:
    clear all
    
    set seed  `=$S_DATE'
    set obs 50
    
    gen id = _n
    expand 10
    
    bys id: gen year = 1990 + _n
    
    gen y = runiform()
    gen x = rbeta(10, 50)
    
    // assign random treatment
    gen randsort = runiform()
    
    bys id (randsort): gen treat = (id <= 20 & _n == 1)
    drop randsort
    bys id (year): replace treat = 1 if treat[_n-1] == 1
    
    
    replace y = cond(treat == 1, y * rnormal(4,.5), -y*rnormal(-1,1))
    egen minyr = min(year) if treat == 1, by(id)
    egen min = min(minyr), by(id)
    
    gen t_to_treat = year - min
    
    xtset id year
    eventdd y x i.year, fe  timevar(t_to_treat)
    
    Fixed-effects (within) regression               Number of obs      =       500
    Group variable: id                              Number of groups   =        50
    
    R-sq:  within  = 0.2500                         Obs per group: min =        10
           between = 0.6648                                        avg =      10.0
           overall = 0.3305                                        max =        10
    
                                                    F(28,422)          =      5.02
    corr(u_i, Xb)  = -0.2582                        Prob > F           =    0.0000
    
    ------------------------------------------------------------------------------
               y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
               x |  -.2564275   .8144306    -0.31   0.753    -1.857273    1.344418
                 |
            year |
           1992  |   .0248702   .1630892     0.15   0.879    -.2956982    .3454386
           1993  |   .1477839   .1636536     0.90   0.367     -.173894    .4694617
           1994  |   .0473551   .1656703     0.29   0.775    -.2782866    .3729968
           1995  |   .2069887   .1666498     1.24   0.215    -.1205783    .5345557
           1996  |   .0506037   .1694123     0.30   0.765    -.2823934    .3836008
           1997  |   .0653017   .1716657     0.38   0.704    -.2721246     .402728
           1998  |  -.0371115   .1747161    -0.21   0.832    -.3805337    .3063107
           1999  |   .0939524   .1785348     0.53   0.599    -.2569758    .4448806
           2000  |  -.0622933   .1828802    -0.34   0.734    -.4217627    .2971762
                 |
            lag9 |     .56447   .4433836     1.27   0.204    -.3070454    1.435985
            lag8 |   .4451548   .3822415     1.16   0.245    -.3061796    1.196489
            lag7 |  -.2394218   .3442743    -0.70   0.487    -.9161278    .4372842
            lag6 |   .1707841   .3291596     0.52   0.604    -.4762125    .8177807
            lag5 |  -.1010052   .2958485    -0.34   0.733    -.6825254    .4805149
            lag4 |  -.2808844   .2872971    -0.98   0.329    -.8455961    .2838272
            lag3 |  -.1426302   .2724303    -0.52   0.601    -.6781196    .3928591
            lag2 |  -.1027444   .2624225    -0.39   0.696    -.6185626    .4130737
           lead0 |   1.230649   .2552361     4.82   0.000     .7289569    1.732342
           lead1 |   1.186767    .277603     4.28   0.000     .6411105    1.732424
           lead2 |   1.293186   .2947188     4.39   0.000     .7138859    1.872485
           lead3 |   1.974063   .3131578     6.30   0.000      1.35852    2.589607
           lead4 |   2.047017   .3293661     6.22   0.000     1.399614    2.694419
           lead5 |   1.544327   .3767436     4.10   0.000     .8037997    2.284855
           lead6 |   1.432389   .4037212     3.55   0.000     .6388342    2.225944
           lead7 |   2.304363   .4783542     4.82   0.000     1.364109    3.244617
           lead8 |   1.342242   .6418521     2.09   0.037     .0806167    2.603867
           lead9 |    1.33457   .8797769     1.52   0.130    -.3947211     3.06386
           _cons |   .5014116   .1922258     2.61   0.009     .1235722     .879251
    -------------+----------------------------------------------------------------
         sigma_u |  .26451997
         sigma_e |  .78345647
             rho |  .10233019   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(49, 422) = 1.02                     Prob > F = 0.4380

    Click image for larger version

Name:	example_.png
Views:	1
Size:	148.2 KB
ID:	1592264

    Clarke, Damian and Schythe, Kathya, Implementing the Panel Event Study. IZA Discussion Paper No. 13524, Available at SSRN: https://ssrn.com/abstract=3660271

    http://ftp.iza.org/dp13524.pdf
    Last edited by Justin Niakamal; 31 Jan 2021, 19:40.

    Comment


    • #3
      Hi @Justin Blasongame,

      I have checked your recommended command eventdd, my problem is that this command also is designed for panel data, and my data structure is time series. I have only DAX index and not different companies. so I don't know how can I use
      xtset id year command. any idea how can I solve this issue? many thanks!

      Comment


      • #4
        Hi Shahrzad,

        If you have time-series data, then you can use regress. From the paper linked above;

        This command [eventdd] can flexibly interact with both in-built Stata commands such as regress and xtreg, as well as the user-written regression command reghdfe"
        And from the help file

        ols Requests that the event study model should be estimated with Stata's regress command. This is the default.
        Hope this helps.

        Comment

        Working...
        X