Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: Time Series Operators and monthly returns after collapse

From   Scott Merryman <>
Subject   Re: st: Time Series Operators and monthly returns after collapse
Date   Wed, 22 Aug 2012 20:26:17 -0500

Are you asking if the -collapse- f6.lret6- is the 6 month return or 1
month return?  Isn't it just the average of the last 6 months?  In the
following simple example, is the mean of lnret what you expect?

set obs 12
gen t = _n
tsset t
set seed 12304
gen x = ceil(runiform()*10)
gen  lnret = ln(x/ l6.x)
collapse (mean) f6.lnret
sum lnre
sum f6.lnre


On Wed, Aug 22, 2012 at 11:33 AM, Daniel Brodback <> wrote:
> Dear all,
> just a quick question because I got quite a bit confused in my analsis with time series operators and monthly returns. I am ranking stocks based on their prior 6 month return and then invest for an additional 6 months.
> I generate the log-return of the previous 6 month with the following command: generate lret6 = ln(price / l6.price)
> Later, I collapse in a foreach-loop:
> collapse (mean) f6.lret6, by(date `var')
> in order to obtain the mean return of my panel.
> Now my question: Do I now have the 6month-return or rather the 1 month return? So far I assumed this would be the 6 month return and hence divided by 6 in order to obtain a monthly return. But after I rethought my code I am not sure whether this was the right thing to do.
> Any input to get me back on the right track is highly appreciated.
> Thanks,
> Daniel

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index