Announcement

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

  • Abnormal return for everday in a year

    Good day everybody,

    I am new to Stata, and came up with an issue regarding the event study. I use the command from Princeton to calculate abnormal returns:
    forvalues i=1(1)N { /*note: replace N with the highest value of id */ l id company_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 } How can I modify this code to make it calculate abnormal returns for everyday in 12-month data, instead of for only event window? Bests <3

  • #2
    Please use formatting (the # symbol on the formatting menu) for such long blocks of code because now they are unreadable.

    The code you are showing computes abnormal returns over everything that is not defined to be an estimation window, as far as I can see.

    Comment


    • #3
      Thanks for your suggestion. Here is the formatted version:
      Code:
       forvalues i=1(1)N { /*note: replace N with the highest value of id */  
       l id company_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 }
      The code calculates for the event window only. I modified such:

      Code:
       forvalues i=1(1)N { /*note: replace N with the highest value of id */  
       l id company_id if id==`i'
       reg ret market_return if id==`i'  
       predict p if id==`i'
       replace predicted_return = p if id==`i'
       drop p }
      But I am not sure if this is a good approach to do.
      Last edited by Anar Aghazada; 27 Aug 2022, 11:03.

      Comment


      • #4
        Your last code is incorrect in the part

        Code:
         
         reg ret market_return if id==`i'
        because it will calculate the market model over your full sample, and this is not what you want. You want to fit the market model only over the estimation window, as in the original code

        Code:
         
         reg ret market_return if id==`i' & estimation_window==1
        Then your second modification does not pick the particular 12 months that you have in mind, but does the prediction over the full samle.

        What you need to do here is to define your event_window variable in such a way, as to capture the 12 months you have on your mind.


        Comment


        • #5
          Oh, thanks so much for your help. My full sample is indeed a 12-month sample. Thus, I think your code will give the same result. I will check both. Thanks, again.

          Comment

          Working...
          X