Page 1 of 1

rolling product

Posted: Thu Feb 10, 2011 7:51 am
by javiersan
Is there any function that allows to calculate the rolling product of the past n obervations? (in a similar way to @movsum or @movcor, something like @prod but with the rolling concept). I have monthly inflation rates and I want to calculate the index y/y value (i.e. the product of (1+i1)(1+i2)(1+i3)...(1+i12) -1).

Thanks,

Javier

Re: rolling product

Posted: Thu Feb 10, 2011 8:42 am
by trubador
Something like the following should do the trick:

Code: Select all

series yoy = 100*(exp(@movsum(log(1+inf/100),12))-1)

Re: rolling product

Posted: Thu Feb 10, 2011 8:51 am
by javiersan
very clever!