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.
Seasonal moving average
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Seasonal moving average
What frequency is your data?
Re: Seasonal moving average
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:
I'm just hoping there's a simpler way to do this.
The formula might be something like:
Code: Select all
genr movavg = (ser01 + ser01(-12) + ser01(-24) + ... + ser01(-228)) / 20
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Seasonal moving average
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.
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
OK. Thanks.
It would be a nice function to have, although I'm not sure how you would set it up.
It would be a nice function to have, although I'm not sure how you would set it up.
Who is online
Users browsing this forum: No registered users and 2 guests
