Page 1 of 1

Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 7:58 am
by aradziwill
I am a relatively experienced user of eviews, but rather new to version eviews 6

I am tryig to convert my annual panel data into 5 years annual averages (create new page with this new frequency)
Somehow, I cannot find the necessary conversion option either in help or FAQ, and I know that my colleagues actually make such conversion outside eviews, either in stata or excel. I m pretty sure there must be an easier way.

How can it be done, many thanks,
Artur

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 9:03 am
by EViews Gareth
You're going to have to be a bit more specific as to what exactly you're trying to do.

Do you want the new page to be a panel, where you're taking the average over 5 year periods, or do you want the new page to be a time-series where you're taking the average over cross-sections?

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 9:06 am
by aradziwill
First option: I want this new page to be a panel, where I am taking the average over 5 year periods (for each cross-section)
Many thanks
Artur

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 9:09 am
by aradziwill
... so that I have new panel that has new frequency, so the observations are 1970-1974, 1975-1979 etc.

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 9:30 am
by EViews Gareth
EViews 6 does not support frequencies of 5 year intervals, you'll have to upgrade to EViews 7 for that.

However you can calculate the averages if you're willing to put the data into an unstructured page. It is a bit tricky, but the following code will do it:

Code: Select all

series t=@trend series t5 = @floor(t/5) pagestruct @date(t) crossid !min = @min(t5) !max = @max(t5) !nobs = !max-!min pagecreate u !nobs series t5=@trend copy(c=mean) untitled\x untitled1\ @src t5 @dest t5
Where X is the series you want to convert, and the page it is currently located in is called "untitled"

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 11:34 am
by aradziwill
Thanks a lot, but it does not seem to do a job for me

In the end, I want to have a panel with the same crossections, but for these new frequencies.
Your program for any given variable x, creates just a number of observations corresponding to number of 5-year periods.
I need this done for every single cross-section in the original panel. Can it be done?

Many thanks, again
Artur

Re: Converting frequency to 5-year average

Posted: Wed Jan 13, 2010 11:37 am
by EViews Gareth
My bad.

Code: Select all

create a 1950 2000 10 series x=nrnd series t=@trend series t5 = @floor(t/5) pagestruct @date(t) crossid !min = @min(t5) !max = @max(t5) !nobs = !max-!min !cross = @max(crossid) pagecreate u 1 !nobs !cross series t5=@trend copy(c=mean) untitled\x untitled1\ @src t5 crossid @dest t5 crossid

Re: Converting frequency to 5-year average

Posted: Thu Jan 14, 2010 3:18 am
by aradziwill
Thank you very much. The last bit I am failing to do is to adjust the code, when the crossid in the origial panel are alphanumeric, such as _AUS, _AUT etc. I am sure it can be done easily but all my efforts produce different error message.
Thank you again very much
Artur

Re: Converting frequency to 5-year average

Posted: Thu Jan 14, 2010 8:32 am
by EViews Gareth
I think the only bit that relies on crossid being numeric is the:

Code: Select all

!cross=@max(crossid)
part, which is simply calculating the number of cross-sections you have. You could change that line to be:

Code: Select all

!cross=10
to manually set the number of cross-sections (where 10 is the number you have).

Re: Converting frequency to 5-year average

Posted: Thu Jan 14, 2010 10:17 am
by aradziwill
I tried changing this and did not work becasue the last command
copy(c=mean) untitled\x untitled1\ @src t5 crossid @dest t5 crossid
is not excecuted due to error (when crossid is alphanumeric)

Re: Converting frequency to 5-year average

Posted: Thu Jan 14, 2010 10:29 am
by EViews Gareth
Ah yes. Good point.

Change crossid to be @crossid

Re: Converting frequency to 5-year average

Posted: Fri Jan 15, 2010 10:17 am
by aradziwill
Thank you very much. I am done now. Have a good weekend
Artur