Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: I have daily returns and a panel: How to calculate annual returns?


From   "Peter Miller" <[email protected]>
To   [email protected]
Subject   st: I have daily returns and a panel: How to calculate annual returns?
Date   Mon, 3 Feb 2014 11:05:16 +0100 (CET)

What I want to do?
I want to calculate the raw return of all my firms in the sample.
- for the first year
- second year
- third year 
- up to three years
 
How does my data look like?
 
Return         Time    Identifier
0             0       7.796e+08
.007751938    2      7.796e+08
.003846154    3      7.796e+08
-.011494253   6      7.796e+08
-.023255814   7      7.796e+08
0             8      7.796e+08
.023809524    9       7.796e+08
0             10      7.796e+08
....  
.             1074    7.796e+08  << Day 1074: Three-year period ends here
-.025806451    0       7.802e+08 << New firm
-.006622517    2       7.802e+08
.026666667     3       7.802e+08
-.032467533    6       7.802e+08
....
   

- The time variable are basically days. However, for some days (e.g. weekends), there are no daily returns available. That's why there are missing values.
- In the best case scenario, all firms have returns for 3 years (1095 days). However, there are firms with less available return data (e.g. only 723 days).
 
- The identifier "identifies" each firm uniquely in the dataset. 
 
What have I done so far?
tsset Identifier Time
xtset Identifier Time

and I got:

tsset Identifier Time
       panel variable:  Identifier (unbalanced)
        time variable:  Time, 0 to 1095, but with gaps
                delta:  1 unit

xtset Identifier Time
       panel variable:  Identifier (unbalanced)
        time variable:  Time, 0 to 1095, but with gaps
                delta:  1 unit

Does anyone know how to proceed further with the return calculation? Basically, the result should look like (Example):

Period         Sample Size        Raw Return
First year         502                10%
Second year        470                9.8%
Third year         432                11.3%
Up to three years  502                35%


Thank you.
Peter

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index