Hello, it's me again
I think, the formulas in User Guide II are not correct. Look at (13.21)-(13.22). They are for HAC corrected variance using Kernel. There is T in indexes and in sum, but really (I've checked it) T in index in (13.22) is not equal to T in the same formula but in sum. First T is a length of input series, because autocovariation is calculated on all observations. But sum is divided on the number of resids, in the model it less, than input series length.
Moreover, I don't understand, why you calculate (13.21) for T-1, where T is the number of resids, not the length of input serie. In case when we have missing values in the middle of series, we will calculate HAC using fewer values. Why?
If you need an example, please, let me know, I'll prepare it. Now I investigate Quadratic Spectral kernel.
Thank you!
Clarifying the formulas in unit root tests
Moderators: EViews Gareth, EViews Moderator
-
kiber_master
- Posts: 94
- Joined: Fri Sep 23, 2011 3:56 am
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Clarifying the formulas in unit root tests
I can't find the equations to which you are referring and am not entirely certain what you are saying [edit - Gareth thinks they are the ones in Chapter 30, which makes sense - in that case the next sentence about needing more clarification is even more relevant]. Could you please double check the printed documentation and offer a bit more explanation. Thanks.
-
kiber_master
- Posts: 94
- Joined: Fri Sep 23, 2011 3:56 am
Re: Clarifying the formulas in unit root tests
I didn't find Chapter 30 in my User Guide... :(
I mean EViews 7 User Guide II.pdf, Chapter 13. Univariate Time Series Analysis, Unit Root Tests, Kernel Sum-of-Covariances Estimation, pp. 388-389
(13.21) is for f0, (13.21) if for gamma(j). Formulas, captured from that pdf are attached.
I mean EViews 7 User Guide II.pdf, Chapter 13. Univariate Time Series Analysis, Unit Root Tests, Kernel Sum-of-Covariances Estimation, pp. 388-389
(13.21) is for f0, (13.21) if for gamma(j). Formulas, captured from that pdf are attached.
- Attachments
-
- formulas (13.21)-(13.22)
- f0.png (4.63 KiB) Viewed 8044 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Clarifying the formulas in unit root tests
You're using the PDF numbering which is off in some versions.
The formulas all assume no internal missings. It would be more confusing for users if we were to make every equation in the manual general enough so that it is valid for missings. In cases where it is not obvious we try to add the generality. In this case you simply set T equal to the number of valid observations in the residual sample.
Note also that the samples here refer to the residual samples as these are generic formulae for computing long-run variances given data. I'll see about making this clearer.
The formulas all assume no internal missings. It would be more confusing for users if we were to make every equation in the manual general enough so that it is valid for missings. In cases where it is not obvious we try to add the generality. In this case you simply set T equal to the number of valid observations in the residual sample.
Note also that the samples here refer to the residual samples as these are generic formulae for computing long-run variances given data. I'll see about making this clearer.
-
kiber_master
- Posts: 94
- Joined: Fri Sep 23, 2011 3:56 am
Re: Clarifying the formulas in unit root tests
Ok, for the second formula it's clear for me now.
But for the first - I've prepared excel calculation of f0 for the test, to understand the algorithm. And discovered the following: though I can calculate gamma(j) for sample length, you use only first T-1 values, where T is the number of valid observations in the residual sample. So, my question is - why don't you use all gamma, which can be calculated?
But for the first - I've prepared excel calculation of f0 for the test, to understand the algorithm. And discovered the following: though I can calculate gamma(j) for sample length, you use only first T-1 values, where T is the number of valid observations in the residual sample. So, my question is - why don't you use all gamma, which can be calculated?
- Attachments
-
- kernel.xlsx
- (27.76 KiB) Downloaded 344 times
-
- testPP.WF1
- (22.84 KiB) Downloaded 330 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Clarifying the formulas in unit root tests
What bandwidth are you using?
-
kiber_master
- Posts: 94
- Joined: Fri Sep 23, 2011 3:56 am
Re: Clarifying the formulas in unit root tests
bandwidth = 1
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Clarifying the formulas in unit root tests
Thanks. This was helpful. It's a bug.
As you noted, for the QS kernel, the number of lags was calculated for the number of observations not the potential range of the lags. In cases where there are no internal missing values, these two numbers are the same. In your case, there are 41 possible lags to compute and 34 observations so EViews was dropping the final 7 terms in the autocovariance sum. The largest of these autocovariance terms was on the order of 1.8e-06 and the total discrepancy was on the order of -4.94e-6. In general, unless you have a very large fraction of internal missing values you'd never see the discrepancy, which is probably why it was missed in testing. Note again that this is generally only relevant for the QS kernel and other kernels with infinite support like the Daniell or for very large bandwidths (except in highly perverse circumstances with large amounts of internal missing data).
That said, I'm very glad that you pointed this one out. I've got a tentative fix in the code. I'm going to do some additional testing, but it should make it's way into a patch in the next few days.
As you noted, for the QS kernel, the number of lags was calculated for the number of observations not the potential range of the lags. In cases where there are no internal missing values, these two numbers are the same. In your case, there are 41 possible lags to compute and 34 observations so EViews was dropping the final 7 terms in the autocovariance sum. The largest of these autocovariance terms was on the order of 1.8e-06 and the total discrepancy was on the order of -4.94e-6. In general, unless you have a very large fraction of internal missing values you'd never see the discrepancy, which is probably why it was missed in testing. Note again that this is generally only relevant for the QS kernel and other kernels with infinite support like the Daniell or for very large bandwidths (except in highly perverse circumstances with large amounts of internal missing data).
That said, I'm very glad that you pointed this one out. I've got a tentative fix in the code. I'm going to do some additional testing, but it should make it's way into a patch in the next few days.
-
kiber_master
- Posts: 94
- Joined: Fri Sep 23, 2011 3:56 am
Re: Clarifying the formulas in unit root tests
Thank you. Glad to be helpful. :)
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Clarifying the formulas in unit root tests
The fix has been posted to the main code base and will appear in the next update. [Edit: Patch is up]
Re: Clarifying the formulas in unit root tests
Friends,
When I test for unit root for my data I found some of my data to be in order of I(0) and others in I(1). To have stationary time series at the same order for all the series is it possible to have the test at the first difference for those that are already stationary at their levels?
When I test for unit root for my data I found some of my data to be in order of I(0) and others in I(1). To have stationary time series at the same order for all the series is it possible to have the test at the first difference for those that are already stationary at their levels?
Who is online
Users browsing this forum: No registered users and 2 guests
