Hello eviews team,
Since this is my first post on this forum, I would like to congratulate all the moderators and users who are making it such a great place to exchange ideas and learn.
I am using eviews 7. I am trying to estimate the output gap from industrial production index in real time. What actually that means, apart from the fact that I am using real time data (the first published estimates), is that I make use of HP Filter (given that monthly data is used, lambda is set to 14400).
My problem is that when I am applying the HP Filter, so that to extract the cycle component, I make use of the whole sample, which becomes very unrealistic given that, for instance, estimating for 1999m1, the data is used from 1999 till 2010. What I would like to do is to recursively estimate the cycle component, based on the HP Filter, only by using the first 5 years, rolling the sample every month.
For example. for 1999m1 the HP Filter would be based on data from 1994m1 till 1999m1, for 1999m2 data from 1994m2 till 1999m2 .... for 2010m1 data from 2005m1 till 2010m1.
Is there a method which I could use in order to accomplish that?
Thank you very much!
rolling the sample?
Moderators: EViews Gareth, EViews Moderator
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: rolling the sample?
You'll have to write an EViews program that will roll the sample. There are lots of examples of doing so here on the forum. This is a good place to start
Re: rolling the sample?
Hey EViews Gareth,
Thank you for the quick reply. Actually I have seen that post, but with my litlle knowledge, I couldn't estimate it.
Let's recap based on the program written in the post.
!window = 60 (the number of months in the sample so that 5 years = 60 months? )
!step = 1 (1 month at a time ? )
!length = @obsrange 1994.01 to 2010.10 (the range ? )
hpf.(14400) ind_prod ind_prod_hp (the HP Filter; yet this is merely creating the trend, not the cycle ?)
!nrolls = @round((!length-!window)/!step)
matrix(3,!nrolls) coefmat (should I include this, since I don't need the coefficients, I suppose not)
(Now here becomes even more complicated)
!j=0
for !i = 1 to !length-!window+1-!step step !step (here I should write that the cycle component estimated for 1999.01, should start from 1994.01 till 1999.01?)
!j=!j+1
smpl @first+!i-1 @first+!i+!window-2
hpf.(14400) ind_prod ind_prod_hp
end
Thank you very much for your time!
Thank you for the quick reply. Actually I have seen that post, but with my litlle knowledge, I couldn't estimate it.
Let's recap based on the program written in the post.
!window = 60 (the number of months in the sample so that 5 years = 60 months? )
!step = 1 (1 month at a time ? )
!length = @obsrange 1994.01 to 2010.10 (the range ? )
hpf.(14400) ind_prod ind_prod_hp (the HP Filter; yet this is merely creating the trend, not the cycle ?)
!nrolls = @round((!length-!window)/!step)
matrix(3,!nrolls) coefmat (should I include this, since I don't need the coefficients, I suppose not)
(Now here becomes even more complicated)
!j=0
for !i = 1 to !length-!window+1-!step step !step (here I should write that the cycle component estimated for 1999.01, should start from 1994.01 till 1999.01?)
!j=!j+1
smpl @first+!i-1 @first+!i+!window-2
hpf.(14400) ind_prod ind_prod_hp
end
Thank you very much for your time!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: rolling the sample?
Your interpretation of !window and !step is correct. !length is the size of the workfile, so can be calculated as just !length=@obsrange
Here's one I knocked up quickly (since you had a go yourself - I'm feeling generous :D)
Here's one I knocked up quickly (since you had a go yourself - I'm feeling generous :D)
Code: Select all
create m 1985 2010 'create a workfile
series y=rnd 'create a series with random data
'-------------------------------------------------------------------------------------
!lambda = 14400 'lambda
' set window size (number of months used in each period's calculation)
!window = 60
' set step size (how many months to move ahead each time)
!step = 1
' get size of workfile
!length = @obsrange
'calculate number of rolls
!nrolls = @round((!length-!window)/!step)
'variable keeping track of how many rolls we've done
!j=0
' move sample !step obs at a time
for !i = 1 to !length-!window+1-!step step !step
!j=!j+1
' set sample to current window
smpl @first+!i-1 @first+!i+!window-2
'run filter
y.hpf(lambda=!lambda) temp
'store coefficients
smpl @first+!i+!window-2 @first+!i+!window-2 'set the sample to be the last observation in the current window, only
series yfilt = temp 'set yfilt equal to temp for the current sample (the last observation only).
d temp 'clean up temporary series.
next
smpl @all 'reset sample back to everything
show yfilt
Re: rolling the sample?
Dear Gareth,
Thank you very much for another unbelievable quick response. Your work is much appreciated.
I am not used to actually get help in my work, therefore believe me, given that for the last four months I am writing on my master thesis, that your generous response is much appreciated.
To elaborate more on the subject of my master thesis, I am describing the monetary policy of ECB through a reaction function based type rule. Moreover, I am comparing the response coefficients of real time data (HICP and industrial production index <-that’s why I needed the output gap) with the response coefficients of forecast based data. And on top of that, compare them when GMM (EONIA) and Probit (MRO) regressions methods are employed. Piece of cake probably to you. :D
Nevertheless tonight I’m programming or at least eviewsing.
Once more, thank you for the help!
Thank you very much for another unbelievable quick response. Your work is much appreciated.
I am not used to actually get help in my work, therefore believe me, given that for the last four months I am writing on my master thesis, that your generous response is much appreciated.
To elaborate more on the subject of my master thesis, I am describing the monetary policy of ECB through a reaction function based type rule. Moreover, I am comparing the response coefficients of real time data (HICP and industrial production index <-that’s why I needed the output gap) with the response coefficients of forecast based data. And on top of that, compare them when GMM (EONIA) and Probit (MRO) regressions methods are employed. Piece of cake probably to you. :D
Nevertheless tonight I’m programming or at least eviewsing.
Once more, thank you for the help!
Re: rolling the sample?
Dear Gareth,
After more than a week of sleepless nights I have done them.
Basically, the probit equations, were estimated under the following:
first i have created a series where the change form t to t-1 is shown. given that the change in MRO's is dicrete, most of the time is 0, when there is a rise it will take the value of 1, when is a drop -1 and when no change is 0.
the code:
series x=mro_change
series y=0
smpl if x<0
y=-1
smpl if x>0
y=1
smpl @all
Furthermore, I have regressed y on some variables, such as inflation and output gap. The coefficients, the lower and upper limits are in line with the literature. The out-of-sample estimations, are perfect. Well actually comparing in the traditional way, given that I had forecasted the change in the MRO, I divided the TRUE forecasts by the total number of forecasts to see whether it has predictive ability. A number of above 80%.
Now the problem is that this method of determining whether the forecasts are or aren't better that a random walk, I have to compute the predictive ability with Henriksson and Merton (1981) test, i.e. usually used in determining the timing ability of portofolion or other related financial matters.
I know that I have allready benefited from your gratitude but I am just asking if this is possible to be done in eviews or does it better be done in excel. And more importantly how it can be done.
Thank you very much in advance!
where j = 3 (given that -1; 0; 1)
sign(It+1-It=k) (is the predicted change) (first minus second, divided again by second; where first is the predicted and the second is the actual)
The test takes the form:
After more than a week of sleepless nights I have done them.
Basically, the probit equations, were estimated under the following:
first i have created a series where the change form t to t-1 is shown. given that the change in MRO's is dicrete, most of the time is 0, when there is a rise it will take the value of 1, when is a drop -1 and when no change is 0.
the code:
series x=mro_change
series y=0
smpl if x<0
y=-1
smpl if x>0
y=1
smpl @all
Furthermore, I have regressed y on some variables, such as inflation and output gap. The coefficients, the lower and upper limits are in line with the literature. The out-of-sample estimations, are perfect. Well actually comparing in the traditional way, given that I had forecasted the change in the MRO, I divided the TRUE forecasts by the total number of forecasts to see whether it has predictive ability. A number of above 80%.
Now the problem is that this method of determining whether the forecasts are or aren't better that a random walk, I have to compute the predictive ability with Henriksson and Merton (1981) test, i.e. usually used in determining the timing ability of portofolion or other related financial matters.
I know that I have allready benefited from your gratitude but I am just asking if this is possible to be done in eviews or does it better be done in excel. And more importantly how it can be done.
Thank you very much in advance!
where j = 3 (given that -1; 0; 1)
sign(It+1-It=k) (is the predicted change) (first minus second, divided again by second; where first is the predicted and the second is the actual)
The test takes the form:
- Attachments
-
- HM.jpg (4.73 KiB) Viewed 6528 times
Who is online
Users browsing this forum: No registered users and 2 guests
