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
Interpreting Oaxaca DecompositionHello everyone, I am using Oaxaca decomposition for my graduation project, where the subject is wag…
iroc does not workDear all, I am running a small logistic regression but I am not getting any value when I type "iroc…
ML command could not find feasible valuesDear STATA experts: I’m learning STATA's maximize likelihood syntax by building my own ordered prob…
Use global macro to call do-file not errorDear All, I'm trying to use the following code to set up global macro and then call do file based o…
How to export variable labels using outreg2 - label option not working?Hi all I want to export my regression tables, showing variable labels instead of names, using the o…
Subscribe to:
Post Comments (Atom)
0 Response to HP filter in panel data
Post a Comment