Page 1 of 1

Clarifying the formulas in unit root tests

Posted: Fri Nov 23, 2012 6:51 am
by kiber_master
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!

Re: Clarifying the formulas in unit root tests

Posted: Mon Nov 26, 2012 10:33 am
by EViews Glenn
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.

Re: Clarifying the formulas in unit root tests

Posted: Tue Nov 27, 2012 7:11 am
by kiber_master
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.

Re: Clarifying the formulas in unit root tests

Posted: Tue Nov 27, 2012 7:55 am
by EViews Glenn
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.

Re: Clarifying the formulas in unit root tests

Posted: Tue Nov 27, 2012 11:57 pm
by kiber_master
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?

Re: Clarifying the formulas in unit root tests

Posted: Wed Nov 28, 2012 5:49 pm
by EViews Glenn
What bandwidth are you using?

Re: Clarifying the formulas in unit root tests

Posted: Thu Nov 29, 2012 12:13 am
by kiber_master
bandwidth = 1

Re: Clarifying the formulas in unit root tests

Posted: Thu Nov 29, 2012 12:12 pm
by EViews Glenn
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.

Re: Clarifying the formulas in unit root tests

Posted: Fri Nov 30, 2012 5:42 am
by kiber_master
Thank you. Glad to be helpful. :)

Re: Clarifying the formulas in unit root tests

Posted: Fri Nov 30, 2012 3:43 pm
by EViews Glenn
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

Posted: Sun Jan 06, 2013 5:48 am
by Abiselom
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?