Page 1 of 1
Seasonal moving average
Posted: Tue Jan 15, 2013 7:19 am
by jthodge
Can you suggest a simple way to calculate a "seasonal moving average"? For example, for a 3-year moving average = (X + X(-12) + X(-24))/3
I'd like to calculate the moving average for each month over a 20-year period and that formula could get pretty cumbersome.
Re: Seasonal moving average
Posted: Tue Jan 15, 2013 8:45 am
by EViews Gareth
What frequency is your data?
Re: Seasonal moving average
Posted: Tue Jan 15, 2013 9:05 am
by jthodge
My data is monthly. So, for each observation, I'd like to calculate a rolling average of the past 20 January values (inclusive of current month) if the observation occurs in January, the past 20 February values if it's a February observation, etc.
The formula might be something like:
Code: Select all
genr movavg = (ser01 + ser01(-12) + ser01(-24) + ... + ser01(-228)) / 20
I'm just hoping there's a simpler way to do this.
Re: Seasonal moving average
Posted: Tue Jan 15, 2013 9:41 am
by EViews Gareth
Nope, that's probably the best way.
You could do something crazy involving copying the data to a new page, removing all non-January months (using pagecontract), then using a simple @movav, then copying back. But that might be more effort than just doing it manually.
Re: Seasonal moving average
Posted: Tue Jan 15, 2013 9:53 am
by jthodge
OK. Thanks.
It would be a nice function to have, although I'm not sure how you would set it up.