Converting frequency to 5-year average

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

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

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Converting frequency to 5-year average

Postby aradziwill » Wed Jan 13, 2010 7:58 am

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

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

Re: Converting frequency to 5-year average

Postby EViews Gareth » Wed Jan 13, 2010 9:03 am

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?
Follow us on Twitter @IHSEViews

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Wed Jan 13, 2010 9:06 am

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

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Wed Jan 13, 2010 9:09 am

... so that I have new panel that has new frequency, so the observations are 1970-1974, 1975-1979 etc.

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

Re: Converting frequency to 5-year average

Postby EViews Gareth » Wed Jan 13, 2010 9:30 am

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"
Follow us on Twitter @IHSEViews

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Wed Jan 13, 2010 11:34 am

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

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

Re: Converting frequency to 5-year average

Postby EViews Gareth » Wed Jan 13, 2010 11:37 am

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
Follow us on Twitter @IHSEViews

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Thu Jan 14, 2010 3:18 am

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

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

Re: Converting frequency to 5-year average

Postby EViews Gareth » Thu Jan 14, 2010 8:32 am

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).
Follow us on Twitter @IHSEViews

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Thu Jan 14, 2010 10:17 am

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)

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

Re: Converting frequency to 5-year average

Postby EViews Gareth » Thu Jan 14, 2010 10:29 am

Ah yes. Good point.

Change crossid to be @crossid
Follow us on Twitter @IHSEViews

aradziwill
Posts: 9
Joined: Wed Jan 13, 2010 7:41 am

Re: Converting frequency to 5-year average

Postby aradziwill » Fri Jan 15, 2010 10:17 am

Thank you very much. I am done now. Have a good weekend
Artur


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 33 guests