Announcement

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

  • Event study - predicted return in estimation window

    Hi, I am doing an Event study using stata and got stuck on estimating the predicted return. I have followed the princeton helpguide website for event studies http://dss.princeton.edu/online_help...ventstudy.html. I have checked the new variables (for example dummies for estimation and event windows) each time I generated the new variable. Until the Estimating Normal Performance part of the event study guide it goes correctly.

    When generating the Predicted return variable, according to the princeton (and other websites) guide, I do not get any numbers in the output for this. Therefore I cannot go further to calculate abnormal returns, it does not give any value. My output notices that there are zero observations for predicted returns.

    Does anyone know where I go wrong? Thanks!

    I have been using the following commands:
    .
    . set more off

    . gen predicted_return=.
    (8,870,724 missing values generated)

    . egen id = group(group_id)

    . forvalues i=1(1)N {
    2. replace N with the highest value of id
    3. l id group_id if id==`i' & dif==0
    4. reg ret market_return if id==`i' & estimation_window==1
    5. predict p if id==`i'
    6. replace predicted_return = p if id==`i' & event_window==1
    7. drop p
    8.
    . }
    invalid syntax
    r(198);

    . sort id date

    . gen abnormal_return=ret-predicted_return if event_window==1
    ret not found
    r(111);

    . gen abnormal_return= stock_returns -predicted_return if event_wi
    > ndow==1
    (8,870,724 missing values generated)


    . summarize predicted_return

    Variable | Obs Mean Std. Dev. Min
    > Max
    -------------+----------------------------------------------------
    > -----
    predicted_~n | 0

    . summarize abnormal_return

    Variable | Obs Mean Std. Dev. Min
    > Max
    -------------+----------------------------------------------------
    > -----
    abnormal_r~n | 0



  • #2
    Your code breaks at
    Code:
     forvalues i=1(1)N {
    2. replace N with the highest value of id
    3. l id group_id if id==`i' & dif==0
    4. reg ret market_return if id==`i' & estimation_window==1
    5. predict p if id==`i'
    6. replace predicted_return = p if id==`i' & event_window==1
    7. drop p
    8. 
    . }
    with a syntax error. Actually there are two syntax errors here, but Stata will have tripped on the first one before getting to the second.

    -forvalues i = 1(1)N {- is not legal syntax. The numbers in -forvalues- must be actual numbers. You can't have N there. You need to have the numerical value of whatever N is (either by typing over N with the actual numerical value or by calculating the value, storing it in a local macro, and then referencing the local macro there. So the following would work if N were, say, 476:

    Code:
    forvalues i = 1(1)476 {
    
    OR
    
    local N 476
    forvalues i = 1(1)`N' {
    The second syntax error, which you will stumble over once you fix the first one, is -replace N with the highest value of id- This is not the syntax of a Stata command at all. I'm guessing that, in fact, it was intended to be a comment whose purpose was to tell you to do just what I outlined above! So I suspect the solution you need ultimately is:

    Code:
    //    replace N with the highest value of id
    summ id
    local N = r(max)
     forvalues i=1(1)`N' {
        l id group_id if id==`i' & dif==0
        reg ret market_return if id==`i' & estimation_window==1
        predict p if id==`i'
        replace predicted_return = p if id==`i' & event_window==1
        drop p
    }

    Comment

    Working...
    X