Page 1 of 2
Panel HP filtering
Posted: Wed Feb 25, 2009 1:53 am
by naturama
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.
Re: Panel HP filtering
Posted: Wed Feb 25, 2009 9:03 am
by EViews Gareth
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?
Re: Panel HP filtering
Posted: Thu Feb 26, 2009 1:08 pm
by naturama
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
Re: Panel HP filtering
Posted: Thu Feb 26, 2009 1:19 pm
by EViews Gareth
What is the build date of your copy of EViews 5?
(You can check this by clicking on Help->About EViews).
Re: Panel HP filtering
Posted: Fri Feb 27, 2009 2:28 am
by naturama
"Standard Edition - Aug 20 2004 build"
Re: Panel HP filtering
Posted: Fri Feb 27, 2009 9:04 am
by EViews Gareth
You're very out-of-date. You should
update your copy.
Re: Panel HP filtering
Posted: Mon Feb 11, 2013 12:46 pm
by fnarita
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
Re: Panel HP filtering
Posted: Mon Feb 11, 2013 12:48 pm
by EViews Gareth
You'll have to copy the series into a non-panel workfile.
Re: Panel HP filtering
Posted: Mon Feb 11, 2013 1:11 pm
by fnarita
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
Re: Panel HP filtering
Posted: Mon Feb 11, 2013 3:21 pm
by fnarita
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
Re: Panel HP filtering
Posted: Mon Sep 30, 2013 8:57 am
by firoozehee
Hi
please help me

:( . 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?
Re: Panel HP filtering
Posted: Mon Aug 18, 2014 10:43 am
by felix.casares
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
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
Re: Panel HP filtering
Posted: Mon Aug 18, 2014 11:20 am
by EViews Gareth
Did you copy his line exactly?
Re: Panel HP filtering
Posted: Mon Aug 18, 2014 11:50 am
by felix.casares
yes i do, exactly
Re: Panel HP filtering
Posted: Mon Aug 18, 2014 11:50 am
by EViews Gareth
The error message would indicate you're missing a %