Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Rolling Return calculation


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Rolling Return calculation
Date   Tue, 21 Jun 2005 16:00:38 +0100

Your example seems ambiguous. Is this 
just the product this * last, or 
it the cumulative product? 

Cumulative products are exp(sum(log()))
so long as all values are positive. 

Nick 
[email protected] 

kelly johnson
 
> I have a quick question. Suppose I have data like the following:
> 
> 
> Date	Return	Return+1	Rolling Ret
> 6/21/2005	0.078	1.078	1.078
> 6/20/2005	0.051	1.051	1.132978
> 6/19/2005	0.04163	1.04163	1.180144
> 6/18/2005	0.025	1.025	1.209647
> 6/17/2005	0.045	1.045	1.264082
> 6/16/2005	0.045	1.045	1.320965
> 6/15/2005	0.01	1.01	1.334175
> 6/14/2005	0.15	1.15	1.534301
> 6/13/2005	0.004	1.004	1.540438
> 6/12/2005	0.05	1.05	1.61746
> 6/11/2005	0.054	1.054	1.704803
> 6/10/2005	0.045	1.045	1.781519
> 6/9/2005	0.016	1.016	1.810024
> 
> 
> date is the date
> return is a percentage return
> return +1=return+1
> 
> how do i create a rolling return in stata? it has a value of 
> 1 initially. 
> first obs is 1*1.078, the second obs is 1.078*1.1051, and so on.
> 
> i have a long data series (1000 obs). how can i code a 
> function to generate 
> this variable?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index