I have a balanced panel (panel of 216 countries, time is months from Jan 1970 to Dec 2017). A sample of my data:
The exercise is quite simple. I am trying to decompose my series on GDP into trend and cyclical component using an HP filter. However, when I try to use the HP filter I get:
There seems to be no problem with the panel structure. Furthermore, tsfilter hp should be able to handle panel structures and not just time series. Some description of my panel structure:
Some further points: my time variable is in %tm format, generated using the monthly() function. Some countries have missing values of gdp_ln, but no country has ALL missing values.
I am stumped as to what the gap in sample refers to.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str52 CountryName float(country_id date year month gdp_ln) "Afghanistan" 4 120 1970 1 21.282246 "Afghanistan" 4 121 1970 2 21.282246 "Afghanistan" 4 122 1970 3 21.282246 "Afghanistan" 4 123 1970 4 21.282246 "Afghanistan" 4 124 1970 5 21.282246 "Afghanistan" 4 125 1970 6 21.282246 "Afghanistan" 4 126 1970 7 21.282246 "Afghanistan" 4 127 1970 8 21.282246 "Afghanistan" 4 128 1970 9 21.282246 "Afghanistan" 4 129 1970 10 21.282246 "Afghanistan" 4 130 1970 11 21.282246 "Afghanistan" 4 131 1970 12 21.282246 "Afghanistan" 4 132 1971 1 21.32819 "Afghanistan" 4 133 1971 2 21.32819 "Afghanistan" 4 134 1971 3 21.32819 "Afghanistan" 4 135 1971 4 21.32819 "Afghanistan" 4 136 1971 5 21.32819 "Afghanistan" 4 137 1971 6 21.32819 "Afghanistan" 4 138 1971 7 21.32819 "Afghanistan" 4 139 1971 8 21.32819 end format %tm date label values country_id c_all label def c_all 4 "Afghanistan", modify
Code:
tsfilter hp gdp_hp = gdp_ln Number of gaps in sample: 1 (gap count includes panel changes) sample may not contain gaps r(498);
Code:
xtset country_id date panel variable: country_id (strongly balanced) time variable: date, 1970m1 to 2018m12 delta: 1 month xtdescribe country_id: 4, 8, ..., 999 n = 216 date: 1970m1, 1970m2, ..., 2018m12 T = 588 Delta(date) = 1 month Span(date) = 588 periods (country_id*date uniquely identifies each observation) Distribution of T_i: min 5% 25% 50% 75% 95% max 588 588 588 588 588 588 588 Freq. Percent Cum. | Pattern* ---------------------------+--------------------------------------------------------------------------------------------------- > --------------------- 216 100.00 100.00 | 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 > 555555555555555555553 ---------------------------+--------------------------------------------------------------------------------------------------- > --------------------- 216 100.00 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > XXXXXXXXXXXXXXXXXXXXX ------------------------------------------------------------------------------------------------------------------------------- > --------------------- *Each column represents 5 periods.
I am stumped as to what the gap in sample refers to.
Comment