Hello,
I am working with panel data and I'd like to apply the Hodrick Prescott filter on a variable (v2x_polyarchy) for each country.
I have tried the following:
encode country_text_id, gen(countries)
xtset countries year
tsfilter hp cycle_dem = v2x_polyarchy, smooth(400) trend(hptrend_dem)
But it runs only for a couple of countries and this problem emerges:
Number of gaps in sample: 1 (gap count includes panel changes)
sample may not contain gaps
I have also tried to run a loop and that for each country the filter will be applied generating a different variable with each cycle.
encode country_text_id, gen(countries)
xtset countries year
foreach i in countries {
tsfilter hp cycle_dem_`i' = v2x_polyarchy, smooth(400) trend(hptrend_dem_`i')
}
But now the problem remains the same and only one variable is created (with the name cycle_dem_countries) instead of one for each country's cycle.
Could anyone please tell me what am I doing wrong?
Thnk you all
Related Posts with HP filter in panel data
How do I get the direct, indirect, and total marginal effects from a probit model with spatial lags?I have searched for Stata commands or routines for spatial probit regression but I could not find on…
6 groups in one graphHello everyone, I want to have a graph with 6 groups in it. I am able to produce a graph with 6 sm…
Installing an ado-fileHi, I have dowloaded an ado-file for updating the mvdcmp command but I'm not able to install the pac…
Overlay predicted probabilities from separate logistic regressionsI would like to overlay predicted probabilities from two separate logistic regressions. My outcome o…
Print out matrix values in the process of Mata functionHello all, I was trying to print out intermediate matrix results in order to debug my Mata function…
Subscribe to:
Post Comments (Atom)
0 Response to HP filter in panel data
Post a Comment