Panel HP filtering

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

naturama
Posts: 6
Joined: Thu Feb 19, 2009 3:22 am

Panel HP filtering

Postby naturama » Wed Feb 25, 2009 1:53 am

I HP filtered a panel with 21 nations. Then I unstacked the panel, I took the raw variables and I HP filtered the series one by one (I mean country by country). Surprisingly the filtered output is not the same, why? any hints?

Thanks for helping me.

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

Re: Panel HP filtering

Postby EViews Gareth » Wed Feb 25, 2009 9:03 am

Hi.

I'm sure I understand what you mean by this question. HP filtering is not allowed on panel workfiles (EViews will produce an error message stating this if you try it).

How did you perform the HP filtering?
Follow us on Twitter @IHSEViews

naturama
Posts: 6
Joined: Thu Feb 19, 2009 3:22 am

Re: Panel HP filtering

Postby naturama » Thu Feb 26, 2009 1:08 pm

EViews 5

a) workfile with panel structure
b) open one series
c) Proc/HP Filter
d) you got the original series filtered

Thanks a lot for your prompt reply

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

Re: Panel HP filtering

Postby EViews Gareth » Thu Feb 26, 2009 1:19 pm

What is the build date of your copy of EViews 5?

(You can check this by clicking on Help->About EViews).
Follow us on Twitter @IHSEViews

naturama
Posts: 6
Joined: Thu Feb 19, 2009 3:22 am

Re: Panel HP filtering

Postby naturama » Fri Feb 27, 2009 2:28 am

"Standard Edition - Aug 20 2004 build"

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

Re: Panel HP filtering

Postby EViews Gareth » Fri Feb 27, 2009 9:04 am

You're very out-of-date. You should update your copy.
Follow us on Twitter @IHSEViews

fnarita
Posts: 15
Joined: Thu Jun 04, 2009 11:15 am

Re: Panel HP filtering

Postby fnarita » Mon Feb 11, 2013 12:46 pm

Hi all,

I would like to know any update available on this issue since EViews version 5.

I'm using EViews version 7.2, but having a trouble in HP-filtering using panel data.

My code is:

Code: Select all

' Work on counry by country
series temp = @crossid
!ncross = @max(temp)
delete temp
for !i=1 to !ncross
   smpl if @crossid = !i
   ' Detrend using HP-filter
   ln_gdp_sa.hpf(lambda=1000) gdp_hp
next

where I have a series named ln_gdp_sa for several countries. I attached my sample data only containing two countries.

Please let me know if there is any way to do HP-filtering for panel data using EViews.

Thank you very much for your help,
Futoshi
Attachments
sampledata.wf1
(14.92 KiB) Downloaded 237 times

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

Re: Panel HP filtering

Postby EViews Gareth » Mon Feb 11, 2013 12:48 pm

You'll have to copy the series into a non-panel workfile.
Follow us on Twitter @IHSEViews

fnarita
Posts: 15
Joined: Thu Jun 04, 2009 11:15 am

Re: Panel HP filtering

Postby fnarita » Mon Feb 11, 2013 1:11 pm

Hi Gareth,

Thank you so much for your very quick reply!

I'm trying to implement what you advised, but could you fix the following code?

The problem is I cannot copy back the HP filtered series to the paneled page, matching the crossid that is being worked on.

Code: Select all

' Create a page to conduct HP-filtering
pagecreate(page=nonpanel) q 1990q1 2012q2
pageselect Untitled1

' Work on counry by country
series temp = @crossid
!ncross = @max(temp)
delete temp
for !i=1 to !ncross
   smpl if @crossid = !i
   ' Detrend using HP-filter
   copy(smpl="1990q1 2012q2") ln_gdp_sa nonpanel\ @src @date @dest @date
   pageselect nonpanel
   ln_gdp_sa.hpf(lambda=1000) gdp_hp
               
   ' Here is my problem
   copy(smpl="1990q1 2012q2") gdp_hp Untitled1\ @src @date @dest @crossid = !i @date

   pageselect Untitled1
next

fnarita
Posts: 15
Joined: Thu Jun 04, 2009 11:15 am

Re: Panel HP filtering

Postby fnarita » Mon Feb 11, 2013 3:21 pm

Hi all,

I figured it out by myself, but thank Gareth anyway for letting me know what I have to do.

I needed more lines and thoughts than I expected to fix my codes above, but anyway the following codes worked. Hope this would be a help to somebody else who wants to do panel HP-filtering using EViews.

Code: Select all

'  Open DATA workfile.
open ./sampledata.wf1
smpl @all

' Create a page to conduct HP-filtering
pagecreate(page=nonpanel) q 1990q1 2012q2
pageselect Untitled1

' Work on counry by country
series temp = @crossid
!ncross = @max(temp)
delete temp
for !i=1 to !ncross
   ' Copy the series of interest to a page without a panel structure.
   %strsmpl ="1990q1 2012q2 if @crossid = !i"
   copy(smpl={%strsmpl}) ln_gdp_sa nonpanel\ @src @date @dest @date

   pageselect nonpanel   
   ' Detrend using HP-filter.
   ln_gdp_sa.hpf(lambda=1000) gdp_hp_tmp
   ' Copy the results to the main page.
   copy gdp_hp_tmp Untitled1\ @src @date @dest @date
   
   pageselect Untitled1
   smpl if @crossid = !i
   series gdp_hp = gdp_hp_tmp
   delete gdp_hp_tmp
next

smpl @all


Please let me know any easier ways and/or any mistakes. The sample data was attached again just for convenience.

Best Regards,
Futoshi
Attachments
sampledata.wf1
(14.92 KiB) Downloaded 252 times

firoozehee
Posts: 1
Joined: Mon Sep 30, 2013 8:53 am

Re: Panel HP filtering

Postby firoozehee » Mon Sep 30, 2013 8:57 am

Hi
please help me :roll: :( . i have a panel data containing 14 countries for 25 years. i must specify oil shock in those countries. am i true or not? i have to estimate it one by one in all 14 countries? So how should I use them in panel data to estimate asymmetric effect of oil shock in GDP growth?

felix.casares
Posts: 23
Joined: Fri Jun 21, 2013 11:34 am

Re: Panel HP filtering

Postby felix.casares » Mon Aug 18, 2014 10:43 am

it doesn´t work to me :(

message error "copy(smpl={strsmpl}) ln_gdp_sa nonpanel\ @src @date @dest @date": strsmpl is not a valid string or scalar name


Please help, im build a panel data set and i want to do HP filter for each company

fnarita wrote:Hi all,

I figured it out by myself, but thank Gareth anyway for letting me know what I have to do.

I needed more lines and thoughts than I expected to fix my codes above, but anyway the following codes worked. Hope this would be a help to somebody else who wants to do panel HP-filtering using EViews.

Code: Select all

'  Open DATA workfile.
open ./sampledata.wf1
smpl @all

' Create a page to conduct HP-filtering
pagecreate(page=nonpanel) q 1990q1 2012q2
pageselect Untitled1

' Work on counry by country
series temp = @crossid
!ncross = @max(temp)
delete temp
for !i=1 to !ncross
   ' Copy the series of interest to a page without a panel structure.
   %strsmpl ="1990q1 2012q2 if @crossid = !i"
   copy(smpl={%strsmpl}) ln_gdp_sa nonpanel\ @src @date @dest @date

   pageselect nonpanel   
   ' Detrend using HP-filter.
   ln_gdp_sa.hpf(lambda=1000) gdp_hp_tmp
   ' Copy the results to the main page.
   copy gdp_hp_tmp Untitled1\ @src @date @dest @date
   
   pageselect Untitled1
   smpl if @crossid = !i
   series gdp_hp = gdp_hp_tmp
   delete gdp_hp_tmp
next

smpl @all


Please let me know any easier ways and/or any mistakes. The sample data was attached again just for convenience.

Best Regards,
Futoshi

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

Re: Panel HP filtering

Postby EViews Gareth » Mon Aug 18, 2014 11:20 am

Did you copy his line exactly?
Follow us on Twitter @IHSEViews

felix.casares
Posts: 23
Joined: Fri Jun 21, 2013 11:34 am

Re: Panel HP filtering

Postby felix.casares » Mon Aug 18, 2014 11:50 am

yes i do, exactly

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

Re: Panel HP filtering

Postby EViews Gareth » Mon Aug 18, 2014 11:50 am

The error message would indicate you're missing a %
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 3 guests