Frequency Conversion

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

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

Frequency Conversion

Postby EViews Gareth » Thu Feb 03, 2011 4:27 pm

This post is going to explain how to perform simple frequency conversion inside EViews.

Frequency conversion lets you convert a series of data from one workfile frequency to another. For example you might have quarterly data that you want to use together with annual data, requiring you to convert it from quarterly to annual. In EViews this means that you copy a series from one page of a workfile to another page with a different frequency. Although EViews lets you copy from one workfile to another workfile, it often makes sense to perform the copy between pages of the same workfile.

In this example I will be using the following workfile containing US macro-economic data (downloaded using the handy GetMacroData Add-in):
Image
You can download the workfile from here.

As you can see, this workfile has three pages - an Annual page, a Quarterly page and a Monthly page. The annual page contains real GDP data, the quarterly page contains nominal GDP data, and the monthly page contains unemployment data.

The first thing we'll do is convert realGDP to a quarterly frequency. To do this we select the Annual page, right click on the realgdp series, and select copy:
Image

We then select the quarterly page, right click in some of the white space, and select Paste Special:
Image

This brings up the paste special dialog:
Image

There's a few things to talk about here. The first "Pattern" box lets you specify the name that will be used in the destination page. If you want to keep the same name as the original series (realgdp in our case), just leave that box as it is (i.e. with a "*" in it).

Following that you have a choice whether to paste as a "Series (by Value)" or as a "Link". If you choose to paste as a Series, then the copy will be a one-off event. The Quartely page will have a snapshot of the realgdp data at the time the copy was done. If you choose to paste as a Link, the data in the Quarterly page will permanently be linked to the data in the Annual page - that is whenever the data in the Annual page changes, the data in the Quarterly page will also change.

The right hand side of the dialog lets you specify the frequency conversion options. There are two sets of options - "High to low" and "Low to high". If your source page has a higher date frequency than your destination page, you should set the "high to low" options. If your source page has a lower date frequency than your destination page, you should set the "low to high" options.

Since we are moving from annual to quarterly, we are moving from a lower frequency to a higher one, and so should set the "Low to high" options:
Image

A description of these is:
  • Constant-match average: This simply repeats the low value for each of the high observations. i.e. each quarter in 2009 will have the same value as the annual value for 2009.
  • Constant-match sum: This simply repeats the low value divided by the number of observations in the high page. i.e. each quarter in 2009 will have the annual value for 2009 divided by 4 (since there are 4 quarters in a year).
  • Quadratic-match average: This performs a proprietary local quadratic interpolation of the low frequency data to fill in the high observations.
  • Quadratic-match sum: This performs the same proprietary local quadratic interpolation, but this time the low frequency data is divided by the number of observations first.
  • Linear-match last: This inserts the low observation value into the last period of the high frequency data, then performs linear interpolation on the missing values. i.e. 2009Q4 will be given the annual 2009 value, 2010Q4 will be given the annual 2010 value, then linear interpolation will fill in 2010Q1, 2010Q2, 2010Q3.
  • Cubic-match last: This is the same as linear-match last, but rather than linear interpolation, a cubic spline is used for the interpolation.

For our realgdp series, we'll use Linear-match last (which means we're assuming that real GDP grows at a linear rate throughout the year), and we'll choose to paste as a link. Once we hit OK, you can see the series has been copied to the Quarterly page:
Image

And the frequency conversion is complete. If you open the realgdp link on the quarterly page and open the realgdp series on the annual page, and put them next to each other, you can see how the linear-match last frequency conversion worked:
Image
Follow us on Twitter @IHSEViews

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

Re: Frequency Conversion

Postby EViews Gareth » Thu Feb 03, 2011 4:54 pm

In the second part of this guide we're going to use frequency conversion to convert the monthly unemployment rate (unrate) into quarterly data.

To start we do as we did before, we select the Monthly page, right click on the unrate series and select Copy, then open the Quarterly page, right click in a blank space and select Paste Special. However, this time we are moving from a higher data frequency to a lower, so we select a High to low option:
Image

These options are:
  • Average observations: Set the low observation equal to the average of the observations in the corresponding high observations. i.e. take the average of Jan 2009, Feb 2009, and March 2009 and put them into 2009Q1.
  • Sum observations: Set the low observation equal to the sum of the observations in the corresponding high observations. i.e. take the sum of Jan 2009, Feb 2009, and March 2009 and put them into 2009Q1.
  • First observation: Set the low observation equal to the value in the first of the corresponding high observations. i.e. take the value of Jan
    2009 and put it into 2009Q1.
  • Last observation: Set the low observation equal to the value in the last of the corresponding high observations. i.e. take the value of March 2009 and put it into 2009Q1.
  • Max observation: Set the low observation equal to the maximum of the corresponding high observations. i.e. take the max of Jan 2009, Feb 2009 and March 2009 and put it into 2009Q1.
  • Min observation: Set the low observation equal to the minimum of the corresponding high observations. i.e. take the min of Jan 2009, Feb 2009 and March 2009 and put it into 2009Q1.

For our unrate series we'll select Last observation as the conversion method. Once you've hit ok, you can again open up the unrate link on the Quarterly page, and the unrate series on the Monthly page to see how the conversion worked:
Image
Follow us on Twitter @IHSEViews

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

Re: Frequency Conversion

Postby EViews Gareth » Tue Mar 01, 2011 10:55 am

Panel Frequency Conversion
It is often the case that you might want to use frequency conversion on panel workfiles. For more information on panel workfiles in general, see the posts here and here.

There are three types of frequency conversion that can occur with regards to panel workfiles. The first is panel to panel, the second is panel to time-series and the third is time-series to panel.

Panel to panel frequency conversion is very similar to the standard time-series frequency conversion shown above. However EViews does not support any low-to-high frequency conversion methods other than "constant match average" when going from Panel to Panel.
For this example we'll be using the following workfile:
Image
You can download it from here.

The first thing to note is that simple panel frequency conversion requires that the cross-section identifier series in the two panel pages are identical. In our case we are using COUNTRY as the cross-section IDs in both pages. It is not an issue if one page has more, or less, cross-sections than the other, as long as there is some over lap and the series name is the same.

To convert the GDP series from the annual panel page to the quarterly panel page we follow the same steps as above, we copy the series in the annual page, then paste special in the quarterly page, then select the low-high frequency conversion method you want. Since EViews understands perfectly the panel nature of the two pages, it can perform this frequency conversion in exactly the same way as for the non-panel frequency conversions above.


To perform conversion from a panel page to a non-panel page, we take the exact same first steps again, copying GDP from the "AnnualPanel" page, and pasting into the non-panel page called "Annual". In the paste-special dialog, we choose "General match-merge criteria" as the Merge by type. This changes the options we can set:
Image

Note how on the right we now have to set the Source ID and the Destination ID. Since we are going to be converting by date (i.e. we're using the date structure in the panel page to align observations with the date structure in the non-panel page), we need to tell EViews that we want to use dates as both the source ID and the destination ID. To do this we enter the "@date" keyword to tell EViews to use dates. Note that, actually, since EViews knows that both the source and destination pages are dated, it filled in the "@date"s for us.

The second thing we need to do is to set the Contraction method. This means, how do we want to squash down the cross-sections to make one single time series. The allowed contractions are quite self-explanatory. For the vast majority of panel-time-series conversions, you would probably want to either use "Sum" (which simply sums up the cross-section observations for each time period), or "Mean" (which averages them out). We'll use "Sum" in our example:
Image

If everything went right, then the value for 1990 in the Annual page should be equal to the sum of the 1990 values for the cross-sections in the AnnualPanel page. The annual values are:

Code: Select all

FRA - 98.12266
JPN - 36.10478
UK - 91.70048
USA - 80.77083

Summing those up gives us a value of 306.6987, which does match the value EViews gave in the Annual page.



Frequency converting from a non-panel page to a panel page is essentially the same as converting from a non-panel to a non-panel. There's a couple of things to notice, however. If you copy from a non-panel page of the same date frequency as the panel page (e.g. copying from the Annual page in our workfile to the AnnualPanel page), then there are no frequency conversion options. EViews will simply repeat the values for each cross-section. Thus if we copy the series "INFL" from the Annual page to the AnnualPanel page, then the value for Fra-1990 will be equal to the value for UK-1990, which will be equal to the value for USA-1990 and JPN-1990, and they will all equal the original Annual page value for 1990.

Converting to a page with a different date frequency works the same way, except this time you can choose the frequency conversion options in the same manner.
Follow us on Twitter @IHSEViews

tbui
Posts: 18
Joined: Tue Dec 21, 2010 3:26 pm

Re: Frequency Conversion

Postby tbui » Thu Mar 10, 2011 2:27 pm

Do you have a piece of codes that will do those panel to panel conversion? I have a workfile in daily data and now want to convert to weekly average data. I can do these steps manually but prefer to have a program so that I can reproduce the results in future.
Thanks alot

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

Re: Frequency Conversion

Postby EViews Gareth » Thu Mar 10, 2011 2:33 pm

It is just the copy command.
Follow us on Twitter @IHSEViews

ecotrixguy
Posts: 6
Joined: Fri Jun 04, 2010 8:28 am

Re: Frequency Conversion

Postby ecotrixguy » Thu Apr 21, 2011 12:48 am

Thanks, Gareth. Continuing from the low to high example, is there a way to copy the annual data to the quarterly page, without interpolation, i.e., simply have N/A's for 3 quarters, and show the annual data against one of the quarters. This might be useful if one wanted to do a mixed frequency regression (this is what I am trying to do now!)? Sorry if this sounds naive-I am new to frequency conversion!

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

Re: Frequency Conversion

Postby EViews Gareth » Thu Apr 21, 2011 8:05 am

No, but you could use Linear Match Last, and then insert NAs for quarters 1,2 and 3:

Code: Select all

smpl if @quarter=1 or @quarter=2 or @quarter=3
myseries = na
Follow us on Twitter @IHSEViews

ecotrixguy
Posts: 6
Joined: Fri Jun 04, 2010 8:28 am

Re: Frequency Conversion

Postby ecotrixguy » Thu Apr 21, 2011 10:33 pm

Thanks Gareth! I figured out something similar. I actually have weekly & daily data for 1 year, and I defined a dummy in the daily page for the week numbers, generated a series for the change in week number, and recoded the imported weekly series.

ohino
Posts: 2
Joined: Mon May 30, 2011 4:42 am

Re: Frequency Conversion

Postby ohino » Mon May 30, 2011 5:04 am

I don't know what's wrong! I would like to convert Annual data into Quarterly data. I am not quite advanced in Eviews. I have followed the guidance but somehow "Frequency conversion options" is inactive and i have stuck there. Would you please help me?
I have posted the file i have been working on.
Attachments
GNI.WF1
(14.65 KiB) Downloaded 1152 times

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Frequency Conversion

Postby trubador » Mon May 30, 2011 6:48 am

ohino wrote:I have followed the guidance but somehow "Frequency conversion options" is inactive and i have stuck there. Would you please help me?

The page named "Quarterly" is not actually structured as a quarterly workfile page. Select the "Quarterly" as the active workfile page and then execute following line in the command window:

Code: Select all

pagestruct(freq=q,start=2001,end=2009)

ohino
Posts: 2
Joined: Mon May 30, 2011 4:42 am

Re: Frequency Conversion

Postby ohino » Mon May 30, 2011 11:50 pm

Thank you very much ;)

L-Faire
Posts: 2
Joined: Sun Jun 26, 2011 6:30 am

Re: Frequency Conversion

Postby L-Faire » Sun Jun 26, 2011 6:50 am

Hi Gareth

I've been searching the net on data conversion and found this page. Hope you guys are still active on this topic.

I just went through you example and it works well, but I have a question when you convert annual real gdp to quarterly data.

Since yearly GDP is an aggregrate of all months,it should be decomposed when one converts it to quarterly data, however in your example that does not happen.

For example, in 2001 GDP = 11347. Lets assume that output is the same in every quarter, hence quarterly data would be: 11347/4 = 2837/quarter.

Can you please shed some light on this.

Thanks in advance

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

Frequency Conversion

Postby EViews Gareth » Sun Jun 26, 2011 9:17 am

That's why we offer different frequency conversion options. Sounds like you need to use constant match sum.
Follow us on Twitter @IHSEViews

L-Faire
Posts: 2
Joined: Sun Jun 26, 2011 6:30 am

Re: Frequency Conversion

Postby L-Faire » Sun Jun 26, 2011 12:47 pm

Ah thanks.

Actually, I've got annual data on the public budget balance that I want to convert to quarterly data.

Could you provide me with a link that discusses the method of the frequency functions, for instance the one for quadratic match sum, which seems to offer rather decent figures, but I have no clue if I can justify the use of it.

ardaessin
Posts: 1
Joined: Wed Aug 10, 2011 3:31 am

Re: Frequency Conversion

Postby ardaessin » Wed Aug 10, 2011 5:19 am

Hi again,
I tried to do data converting from quarterly to monthly, but in the first two row of my data set was vanish. I just could see NA expression in that rows. what I need to do to get rid of this. I use version 6.

thanks

ardaessin


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests