Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Hodrick-Prescott Filter issues

From   Christopher Baum <>
To   "" <>
Subject   RE: st: Hodrick-Prescott Filter issues
Date   Tue, 29 May 2012 09:02:07 -0400

Chris said

Thanks for the example and how to make a single variable of the smooth and
residual series. You're correct, I'm using the hprescott routine instead of
the other one (I'm running Stata 11 IC). Unfortunately, I still can't get to
that point, and I know the problem is, as you correctly note, in the tsset,
but I don't know how to get it where it needs to be.

I open my data file, and then get this - 

. tsset
       panel variable:  country1 (unbalanced)
        time variable:  year, 1989 to 2010, but with gaps
                delta:  1 year

The data I have is contiguous, though, from 1989-2010

but when I try to HP, this is what I get

. by country1: hprescott bankcred1, stub(smoothcred) smooth(6.25)

Number of gaps in sample:  1   (gap count includes panel changes)
sample may not contain gaps

Using tsreport, I get

. tsreport, report panel list

Number of gaps in sample:  8

Observations with preceding time gaps
   Record |    country1         year
       90 |     Austria         1999
      190 |     Belgium         1999
      568 |      France         1999
      996 |  Luxembourg         1994
     1000 |  Luxembourg         2000
     1188 | Netherlands         1999
     1479 |     SAfrica         1992
     1809 |      Zambia         1993

HOWEVER, looking at the data, there are no gaps in the data. Austria goes
1998 1999 2000... all the way through. Same with Belgium, France, and all
the others. Could you help me to identify what these gaps are and how to
close them?

Obviously a timeseries that contained annual data 1989-2010 would contain 22 observations per country, and for eight countries, you would have 176 observations, not 1800+. My guess is that your improper tsset relates to the fact that you have firms or banks within each country, each of which has a timeseries. Otherwise how do you get over 90 observations for Austria?!?  If the unit for which you observe timeseries data is the bank or firm, then the tsset should be by bank or firm id and year, not country. Country is a higher-level identifier in that case.

Despite the title of the posting, this is not a HP filter issue. You would have the same problem with any time series command, such as a unit root test or panel unit root test.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index