Converting frequency to 5-year average
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Converting frequency to 5-year average
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Converting frequency to 5-year average
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?
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
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
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
Many thanks
Artur
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
... so that I have new panel that has new frequency, so the observations are 1970-1974, 1975-1979 etc.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Converting frequency to 5-year average
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:
Where X is the series you want to convert, and the page it is currently located in is called "untitled"
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
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Converting frequency to 5-year average
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
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
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
Thank you again very much
Artur
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Converting frequency to 5-year average
I think the only bit that relies on crossid being numeric is the:
part, which is simply calculating the number of cross-sections you have. You could change that line to be:
to manually set the number of cross-sections (where 10 is the number you have).
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
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
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)
copy(c=mean) untitled\x untitled1\ @src t5 crossid @dest t5 crossid
is not excecuted due to error (when crossid is alphanumeric)
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Converting frequency to 5-year average
Ah yes. Good point.
Change crossid to be @crossid
Change crossid to be @crossid
Follow us on Twitter @IHSEViews
-
- Posts: 9
- Joined: Wed Jan 13, 2010 7:41 am
Re: Converting frequency to 5-year average
Thank you very much. I am done now. Have a good weekend
Artur
Artur
Who is online
Users browsing this forum: No registered users and 33 guests