Seasonal moving average

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

jthodge
Posts: 77
Joined: Tue Oct 21, 2008 5:52 am

Seasonal moving average

Postby jthodge » Tue Jan 15, 2013 7:19 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Seasonal moving average

Postby EViews Gareth » Tue Jan 15, 2013 8:45 am

What frequency is your data?

jthodge
Posts: 77
Joined: Tue Oct 21, 2008 5:52 am

Re: Seasonal moving average

Postby jthodge » Tue Jan 15, 2013 9:05 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Seasonal moving average

Postby EViews Gareth » Tue Jan 15, 2013 9:41 am

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.

jthodge
Posts: 77
Joined: Tue Oct 21, 2008 5:52 am

Re: Seasonal moving average

Postby jthodge » Tue Jan 15, 2013 9:53 am

OK. Thanks.

It would be a nice function to have, although I'm not sure how you would set it up.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests