Dear Statlist,
I have the following problem with calculating Hodrick-Precott filter. What I'm trying to do is to calculate deviation of some ratio from its trend, measured with the HP filter, using recursive sample.
Example:
My dataset have a following structue:
period ratio
2000Q1 23.78
2000Q2 25.64
2000Q3 24.97
2000Q4 24.78
2001Q1 24.99
2001Q2 24.96
2001Q3 26.07
2001Q4 25.41
...
Now, I want to calculate a deviation from a trend in each period. To find the trend, using HP filter, I would normally do:
tsfilter hp new_var=ratio, smooth(1600) trend(trend)
But in this way I calculate the trend, using all observations (2000-2001).
What I want to do is to calculate the trend using only the data available up to the given period. So, for the first period the trend will be equal to the ratio (23.78), for the second period it will be calculated using data available in 200Q1 (23.78) and 200Q2 (25.64), etc.
I've tried to run the following code:
rolling,window(100) recursive: tsfilter hp new_var=ratio, smooth(1600) trend(trend)
but I get a following error:
(running tsfilter on estimation sample)
no; data in memory would be lost
r(4);
I would appreciate any help.
Best regards,
Chris
I have the following problem with calculating Hodrick-Precott filter. What I'm trying to do is to calculate deviation of some ratio from its trend, measured with the HP filter, using recursive sample.
Example:
My dataset have a following structue:
period ratio
2000Q1 23.78
2000Q2 25.64
2000Q3 24.97
2000Q4 24.78
2001Q1 24.99
2001Q2 24.96
2001Q3 26.07
2001Q4 25.41
...
Now, I want to calculate a deviation from a trend in each period. To find the trend, using HP filter, I would normally do:
tsfilter hp new_var=ratio, smooth(1600) trend(trend)
But in this way I calculate the trend, using all observations (2000-2001).
What I want to do is to calculate the trend using only the data available up to the given period. So, for the first period the trend will be equal to the ratio (23.78), for the second period it will be calculated using data available in 200Q1 (23.78) and 200Q2 (25.64), etc.
I've tried to run the following code:
rolling,window(100) recursive: tsfilter hp new_var=ratio, smooth(1600) trend(trend)
but I get a following error:
(running tsfilter on estimation sample)
no; data in memory would be lost
r(4);
I would appreciate any help.
Best regards,
Chris
Comment