Has the Eviews calculation of the Lc statistic (cointreg/cointegration test/Hansen's Instability) been checked against the output of the Gauss program posted on Hansen's website? I expect rounding errors to differ, but not sure what order of difference to expect.
Thanks
Lc in Cointreg
Moderators: EViews Gareth, EViews Moderator
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Lc in Cointreg
It's been tested against the Hansen code. There are issues with exactly replicating the results, but you can get close. I'll have to explain in some depth.
The biggest issue is in the specification for the deterministics in the regressor relationship (k1 and k2). In the description of the estimation, Hansen says that he is going to estimate a model that has a constant and a time trend in the equation. He is silent about the specification of the deterministics (k1 and k2) in the regressor equation, but the implication is that k1 has a constant and time trend and that k2 is null.
The actual Hansen code for computing the residuals in the x_2t equations (the u_2t) first differences the x_2t variables, and then obtains the residuals from a regression on a constant and a trend variable. The problem with this is that it is implicitly adding a higher order deterministic to the specification of the x_2t. After differencing, the presence of a constant and trend in x_2t would only involve demeaning the differenced data. I don't think this is what he wanted to do. I think he wanted to demean only. If you want to include the trend, you either obtain the residuals from the trend regression, or difference and obtain the residuals from the constant regression. You shouldn't do both the differencing and the trend regression.
At this point the basic EViews model which involves a trend in both equations would (and does) differ in all calculations.
Now you can get *close* to the Hansen code by adding a quadratic trend to the regressors specification in EViews. If you then use the "Estimate using differenced data" option in EViews you'll get a calculation that is close to Hansen's (since the difference of the quadratic terms is a modified linear trend). [edit] Note however, that Hansen estimates the residuals from the long-run equation slightly differently from EViews; he uses the sample that drops the first observation while EViews uses the full sample, therefore the residuals for the long-run regression are slightly different. Hence the remaining calculations differ slightly. But only slightly.
For example, for the first TC on DI equation, you can get close by estimating
The results are close. The coefficient on DI using EViews with these settings is .9816 with an error of 0.089, versus .9836 and an error of .08788 in the Hansen Gauss output. As you might expect the trend and intercepts are off by a bit more than this, but they're in the ballpark.
As to the differences in the Lc results that began this discussion, the Hansen result is 0.50879397 with a p-value of 0.093352494. The EViews results with these settings is 0.505358 with a p-value of 0.1300. Which is close, but again, not quite. A comment on the p-value. The problem with getting the Hansen result by adding the quadratic deterministic trend to the regressor equations in EViews is that it modifies the asymptotic statistics so that we are assuming a different asymptotic distribution than does Hansen. So while the statistics are close, the p-values will differ because of the differing assumption.
The biggest issue is in the specification for the deterministics in the regressor relationship (k1 and k2). In the description of the estimation, Hansen says that he is going to estimate a model that has a constant and a time trend in the equation. He is silent about the specification of the deterministics (k1 and k2) in the regressor equation, but the implication is that k1 has a constant and time trend and that k2 is null.
The actual Hansen code for computing the residuals in the x_2t equations (the u_2t) first differences the x_2t variables, and then obtains the residuals from a regression on a constant and a trend variable. The problem with this is that it is implicitly adding a higher order deterministic to the specification of the x_2t. After differencing, the presence of a constant and trend in x_2t would only involve demeaning the differenced data. I don't think this is what he wanted to do. I think he wanted to demean only. If you want to include the trend, you either obtain the residuals from the trend regression, or difference and obtain the residuals from the constant regression. You shouldn't do both the differencing and the trend regression.
At this point the basic EViews model which involves a trend in both equations would (and does) differ in all calculations.
Now you can get *close* to the Hansen code by adding a quadratic trend to the regressors specification in EViews. If you then use the "Estimate using differenced data" option in EViews you'll get a calculation that is close to Hansen's (since the difference of the quadratic terms is a modified linear trend). [edit] Note however, that Hansen estimates the residuals from the long-run equation slightly differently from EViews; he uses the sample that drops the first observation while EViews uses the full sample, therefore the residuals for the long-run regression are slightly different. Hence the remaining calculations differ slightly. But only slightly.
For example, for the first TC on DI equation, you can get close by estimating
Code: Select all
equation eqfmols.COINTREG(TREND=LINEAR,REGTREND=QUADRATIC,REGDIFF,LAG=1,KERN=QUADSPEC,BW=ANDREWS) TC DIAs to the differences in the Lc results that began this discussion, the Hansen result is 0.50879397 with a p-value of 0.093352494. The EViews results with these settings is 0.505358 with a p-value of 0.1300. Which is close, but again, not quite. A comment on the p-value. The problem with getting the Hansen result by adding the quadratic deterministic trend to the regressor equations in EViews is that it modifies the asymptotic statistics so that we are assuming a different asymptotic distribution than does Hansen. So while the statistics are close, the p-values will differ because of the differing assumption.
-
ClintonGreene
- Posts: 15
- Joined: Wed Sep 28, 2011 2:08 pm
Re: Lc in Cointreg
Very helpful comments, confirms my motivation for trying to write my own program. For instance, for an interest rate I am comfortable with modeling the u_2t as a trend-free first difference, but for RGDP I would want to see a constant in the differenced regressor model. So I would like to avoid using the same trends in all the regressor equations.
With your help, I have managed to replicate calculation of FMOLS coef estimates. But I seem to be missing some scale factor in the calculation of the Lc. If you would take a look at the attached program I would be grateful. If T is the number of observations of y-hat-plus, then my calculation of the Lc appears to be too large by a factor of T+k (where k is # of all coint regressors including trends) for large samples, but for small samples (less than 400) this is a poor approximation of whatever mistake I am making.
With your help, I have managed to replicate calculation of FMOLS coef estimates. But I seem to be missing some scale factor in the calculation of the Lc. If you would take a look at the attached program I would be grateful. If T is the number of observations of y-hat-plus, then my calculation of the Lc appears to be too large by a factor of T+k (where k is # of all coint regressors including trends) for large samples, but for small samples (less than 400) this is a poor approximation of whatever mistake I am making.
- Attachments
-
- lc_ev_h_consistent2.prg
- (5.71 KiB) Downloaded 496 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Lc in Cointreg
Two things...
First, there is an ambiguity in how one expresses the scale of the Lc statistic. In the original Nyblom paper, the Lc* was equal to T times the statistic presented in the Hansen paper (the variance matrix used in the theory is the limit of the average of the expected value of the scores). Then in Nyblom, the statistic
Lc2 = T^{-2} Lc*
converges to the test distribution of interest (see 3.2 in Nyblom).
Both Hansen (and us, following his notation) write the statistic as
Lc1 = T^{-1} Lc*
but report the Lc2 statistic in the output.
So that's why it's factor of T, or more precisely T-1 since that's the number of valid observations for the FMOLS estimator. Now why your factor differs from that could be a number of issues. I couldn't tell from my quick look at your code what's going on.
Second, your concern about the restricted forms of the deterministic terms in the regressor equations is understandable, but not necessary (at least theoretically). The adjustments to the asymptotic distributions depend only on the column rank of the Pi matrix. So long as you have a given trend determinstic in *any* of the cointegrating regressor equations, it matters asymptotically, even if the coefficients are zero for the remaining equations. So from a theoretical perspective, estimating the restricted form where elements of Pi are constrained to be zero doesn't matter asymptotically. It may, as always, be a different story in finite sample, but I just wanted to point out that perhaps you needn't worry about it.
First, there is an ambiguity in how one expresses the scale of the Lc statistic. In the original Nyblom paper, the Lc* was equal to T times the statistic presented in the Hansen paper (the variance matrix used in the theory is the limit of the average of the expected value of the scores). Then in Nyblom, the statistic
Lc2 = T^{-2} Lc*
converges to the test distribution of interest (see 3.2 in Nyblom).
Both Hansen (and us, following his notation) write the statistic as
Lc1 = T^{-1} Lc*
but report the Lc2 statistic in the output.
So that's why it's factor of T, or more precisely T-1 since that's the number of valid observations for the FMOLS estimator. Now why your factor differs from that could be a number of issues. I couldn't tell from my quick look at your code what's going on.
Second, your concern about the restricted forms of the deterministic terms in the regressor equations is understandable, but not necessary (at least theoretically). The adjustments to the asymptotic distributions depend only on the column rank of the Pi matrix. So long as you have a given trend determinstic in *any* of the cointegrating regressor equations, it matters asymptotically, even if the coefficients are zero for the remaining equations. So from a theoretical perspective, estimating the restricted form where elements of Pi are constrained to be zero doesn't matter asymptotically. It may, as always, be a different story in finite sample, but I just wanted to point out that perhaps you needn't worry about it.
-
ClintonGreene
- Posts: 15
- Joined: Wed Sep 28, 2011 2:08 pm
Re: Lc in Cointreg
I think I have found a couple typographical errors in the users guide documentation for Hansen’s Lc cointegration test. The attached file explains where I think changes are needed. I believe I have the most recent users guide. Also, I am suggesting that some of the notation allows for a vector of cointegrating relationships, but (at least for me) it would be helpful to use simpler single-equation expressions that do not generalize to cointegrating vectors.
Hope some of my comments are useful.
Hope some of my comments are useful.
- Attachments
-
- compare_lc.prg
- (6.31 KiB) Downloaded 474 times
-
- aCommentsEviewsLc.pdf
- (30.47 KiB) Downloaded 635 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Lc in Cointreg
Thanks for the comments.
Who is online
Users browsing this forum: No registered users and 2 guests
