Announcement

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

  • Calculating annual returns that start few months after year end from monthly returns:Monthly-to-Annual

    Hi
    I have a simple question that might be basic for most users here:
    I have monthly stock returns and want to calculate annual returns that start 4 months after the end of the year.
    I used this code to calculate annual returns:
    gen compounded_annual_ret= (1+f1.ret)* (1+f2.ret)*(1+f3.ret)*(1+f4.ret)*(1+f5.ret)*(1+f6. ret)*(1+f7.ret)*(1+f8.ret)*(1+f9.ret)*(1+f10.ret)* (1+f11.ret)*(1+f12.ret)-1
    or simply
    gen annual_ret= f1.ret+f2.ret+f3.ret+f4.ret+f5.ret+f6.ret+f7.ret+f 8.ret+f9.ret+f10.ret+f11.ret+f12.ret

    If I want returns that start 4 months after end of fiscal year for my monthly data, does the following code make any sense?
    gen 4month_compoundedannualret=f4.compounded_annual_re t
    or
    gen 4month_annualret=f4.annual_ret

    My questions are:
    Are the codes used above correct?
    If the identifier is "permno", do I need to add "bysort permno" to the beginning of the annual returns codes above ?

    Thanks in advance

  • #2
    Hi
    Does anyone have some guidelines on how to proceed with these returns ?
    Thanks

    Comment


    • #3
      Mike,

      Your question is not clear to me:

      1. Is the _annual return_ the simple sum of a set of monthly returns?

      2. If so, when you say "want to calculate annual returns that start 4 months after the end of the year.", do you mean the sum should start in may? If so, when does the sum end? In December of that year or in April of the next year?

      3. What does "permno" identify? Different stocks?

      4. Please post example data, representative of your working data set. An example of code producing such a thing:

      Code:
      clear
      set more off
      
      set obs 36
      
      set seed 32896
      
      gen dat = _n - 1
      format %tm dat
      gen year = year(dofm(dat))
      
      gen return = runiform()
      
      list, sepby(year)
      You can also post the data directly, appropriately formatted.

      5. Please follow recommendations given below if you want to increase your chances of getting a good answer, if any at all.
      You should:

      1. Read the FAQ carefully.

      2. "Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!"

      3. Describe your dataset. Use list to list data when you are doing so. Use input to type in your own dataset fragment that others can experiment with.

      4. Use the advanced editing options to appropriately format quotes, data, code and Stata output. The advanced options can be toggled on/off using the A button in the top right corner of the text editor.

      Comment

      Working...
      X