Wednesday, December 9, 2015

Seasonal Unit Root Testing in EViews

When we're dealing with seasonal data - e.g., quarterly data - we need to distinguish between "deterministic seasonality" and "stochastic seasonality". The first type of seasonality is what we try to remove when we "seasonally adjust" the series. It's also what we're trying to account for when we include seasonal dummy variables in a regression model.

On the other hand, "stochastic seasonality" refers to unit roots at the seasonal frequencies. This is a whole different issue, and it's been well researched in the time-series econometrics literature.

This distinction is similar to that between a "deterministic trend" and a "stochastic trend" in annual data. The former can be removed by "de-tending" the series, but the latter refers to a unit root (at the zero frequency).

The most widely used procedure for testing for seasonal unit roots is that proposed by Hylleberg et al. (HEGY) (1990), and extended by Ghysels et al. (1994).

In my graduate-level time-series course we always look at stochastic seasonality. Recently, Nicolas Ronderos has written a new "Add-in" for EViews to make it easy to implement the HEGY testing procedure (see here). This will certainly save some coding for EViews users.  

Of course, stochastic seasonality can also arise in the case of monthly data - this is really messy - see Beaulieu and Miron (1993). In the case of half-yearly data, the necessary theoretical framework and critical values are developed and illustrated by Feltham and Giles (2003)

And if you have unit roots at the seasonal frequencies in two or more time-series, you might also have seasonal cointegration. The seminal contribution relating to this is by Engle et al. (1993), and an short empirical application is provided by Reinhardt and Giles (2001)

I plan to illustrate the application of seasonal unit root and cointegration tests in a future blog post.

(Also, note the comment from Jack Lucchetti, below, that draws attention to a HEGY addon for Gretl, written by Ignacio Diaz Emparanza.)

References

Beaulieu, J. J., and J. A. Miron, 1993. Seasonal unit roots in aggregate U.S. data. Journal of Econometrics, 55, 305-328.

Engle, R. F., C. W. J. Granger, S. Hyleberg, H. S. Lee, 1993. Seasonal cointegration: The Japanese consumption function. Journal of Econometrics, 55, 275-298.

Feltham, S. G. and D. E. A. Giles, 2003. Testing for unit roots in semi-annual data. in D.E.A. Giles 
(ed.), Computer-Aided Econometrics. Marcel Dekker, New York, 175-208. (Pre-print here.)

Ghysels, E., H. S. Lee, and J. Noh, 1994. Testing for unit roots in seasonal time series: Some theoretical extensions and a Monte Carlo investigation. Journal of Econometrics, 62, 415-442.

Hylleberg, S., R. F. Engle, C. W. J. Granger, and B. S. Yoo, 1990. Seasonal integration and cointegration. Journal of Econometrics, 44, 215-238.

Reinhardt, F. S. and D. E. A. Giles, 2001. Are cigarette bans really good economic policy?. Applied Economics, 33, 1365-1368. (Pre-print here.)


© 2015, David E. Giles

23 comments:

  1. Dave, we need more of these articles.

    Is it possible to get say one a week at all?

    These are really educational

    ReplyDelete
  2. be kind to your 1000's of fans Dave

    ReplyDelete
  3. Really interesting topic!!!!!!!!! looking forward to read your post.

    ReplyDelete
  4. Ignacio Diaz Emparanza has written a very nice gretl addon for the HEGY test, which incorporates response surfaces as per his own paper on CSDA (http://www.sciencedirect.com/science/article/pii/S0167947313001047)

    ReplyDelete
    Replies
    1. Thanks Jack - I have updated the post above.

      Delete
    2. Thanks Dave. Also note that Ignacio computed response surfaces for arbitrary periodicities. So if for example you want to run a HEGY test on daily data with weekly spectral peaks, it's easy to do so.

      Delete
  5. Dear Sir,

    Is it enough just to use Dickey Fuller test to ensure we get rid of autocorrelation by differencing the data until we can reject Ho? Because I have a time series data, and for some variables, even after differencing them until I can reject the DF test for unit root, the AC and PAC graphs still look very very weird. Also, is it satisfactory to reject at 5% significant level but not 1%?

    Another question which is not so related to this post which I want to ask is: I have in my model some variables that are integrated of order 0, some are 1, and some are 2. Can I use the ARDL model?

    I'm writing my dissertation and your posts are of so much help. Thank you very much and best regards,

    Chelsea

    ReplyDelete
    Replies
    1. Chelsea: The DF test has nothing to do with autocorrelation. If your data are I(1) and you difference, this might help with error autocorrelation, but that's just incidental. There's no "magic" significance level - it's arbitrary. In ARDL models, you cannot have any series that are I(2) - this is something I have stressed in my various posts about these models.

      Delete
  6. Hi Dave,
    Are you aware of any software procedures (codes) that perform seasonal cointegration test for monthly data?

    ReplyDelete
  7. "I plan to illustrate the application of seasonal unit root and cointegration tests in a future blog post." ....looking forward to it

    ReplyDelete
  8. I read that HEGY was written to deal with quarterly data. What are the implications of running this test on monthly data???

    ReplyDelete
    Replies
    1. Maria - if you have monthly data then HEGY is not appropriate. The appropriate testing is described by Beaulieu and Miron, J. Econometrics 1993. See this link:
      http://www.sciencedirect.com/science/article/pii/030440769390018Z

      Delete
  9. Dear professor Giles. After reading this article, can I conclude that when dealing with quarterly or monthly series, the first step is to perform seasonal unit root tests to assess if the seasonality is deterministic or not? Is this correct? If yes, I have two possible outcomes. One is that the series has deterministic seasonality and in that case I can seasonally adjust it.

    However, if the outcome of the unit root test is tha the seasonality is stochastic, What is next (considering that you reply to a comment in this post that regarding to the availability of codes for cointegration "Nothing comes to mind - sorry")?

    Kind Regards,

    Reynaldo

    ReplyDelete
    Replies
    1. Reynaldo - your interpretation. My earlier remarks are specifically in reference to code for MONTHLY cointgegration. In the case of seasonal cointegration at the quarterly level you don;t need any special "code" the steps are straightforward and can easily be implemented with regular data transformations in EViews, Gretl, Stata, R, etc. See my comments and references towards the end of the above post.

      Delete
    2. I should have said "You interpretation is correct". Sorry. DG

      Delete
  10. I have a HEGY quarterly test where the null of a unit root cannot be rejected at the zero frequency, but the joint test null for all frequencies is rejected.

    In their book Ghysels and Osborn (2001) caution against using the individual frequency results as a substitute for the joint overall test due to the effect of the individual test will have on the significance of the implied joint test.

    However, the authors also state that "Thus, the overall F test of the SI(1) null hypothesis cannot, strictly speaking, be interpreted as testing seasonal integration against the alternative hypothesis of stationarity of the process."

    This leaves me uncertain at to whether I should treat the series as non-stationary due to the zero frequency result or as stationary due to the all frequency result.

    Any guidance you can provide will be appreciated.

    cheers

    ReplyDelete
    Replies
    1. Mike - first of all the general comment about individual tests and joint tests is correct. And it holds in ANY testing situation - it's the standard "pre-test testing" issue.

      Having said that, let's look at what you have found, so far.

      You can't reject a unit root at the zero frequency; but you reject the null of a unit root at all frequencies. So, in addition to the root at the zero frequency, there MAY also be a root at the "pi" frequency; and/or a root at the ("pi"/2, 3*"pi"/2) frequencies. You need to test for each of the other two cases.

      Background - if the series X(t) were "seasonally integrated", it would have a unit root at ALL 4 frequencies. Fourth-differencing X would be the thing to do if it were seasonally integrated. That is, we would need to transform to [X(t)-X(t-4)], or [1-L^4]X(t), where "L" is the usual lag operator. We can obtain the roots by noting that [1-L^4]=[1-L^2][1+L^2]=[1-L][1+L][1+L^2]=[1-L][1+L][1-iL][1+iL] , where "i" is the usual imaginary number, i=SQRT(-1). Solving for the roots of [1-L^4]X(t)=0, we get two real roots: [1-L]X(t)=0, and [1+L]X(t)=0. The first root is the one for the zero frequency. To eliminate it we construct Y1(t)=[1-L]X(t)= [X(t)-X(t-1)]. That is, we first-difference the series. The second real root corresponds to the "pi" frequency, and to eliminate it we construct Y2(t)=[1+L]X(t) = [X(t)+X(t-1)]. The remaining 2 roots form a complex-conjugate pair. As we can't "observe" imaginary or complex numbers, we can't transform X to eliminate a root at JUST the "pi"/2 frequency, or JUST the 3*"pi"/2 frequency. If we construct Y3(t)=[1+L^2]X(t) = [X(t)+X(t-2)], this will eliminate roots at the (joint) "pi"/2 and 3*"pi"/2 frequencies.

      To summarize - you now need to apply the HEGY tests for unit roots at the "pi" and "pi"/2, 3*"pi"/2 frequencies. There are several possible outcomes.

      1. You may reject the null in both of these cases. In that case you still have a unit root at the zero frequency. You series can be made stationary by first-differencing.

      2. You may NOT reject the null for the "pi" frequency, but you reject for the "pi"/2, 3*"pi"/2 case. If so, you can make your X series stationary by filtering it to form Z(t) = [1-L][1+L]X(t) = [1-L^2]X(t) = X(t)-X(t-2). The first part of the filter is for the unit root at the zero frequency; the second part is for the root at the "pi" frequency".

      3. You may reject the null of a root at the "pi" frequency, but NOT reject for the other composite frequency. In that case, the appropriate filter for X is to form W(t)=[1-L][1+L^2]X(t)=[1-L+L^2-L3]X(t) = [X(t)-X(t-1)+X(t-2)-X(t-3)].

      4. You should't get the situation where you DO NOT reject the null for both tests. If you did, then this would imply a unit root at ALL frequencies, and you've ruled this out already.

      I hope this helps.

      Delete
  11. Professor,

    Thank, that was helpful.
    I have tested at the different frequencies and they do reject the null. Not surprisingly then the joint test for all seasonal frequencies also rejects the null. The issue I am having is that the joint test of all frequencies as this test also rejects the null. How do I reconcile the non-rejection of the null at zero frequency with the rejection of the null at all frequencies. My intuition is to accept the zero frequency has a unit root despite the results of the joint all frequency test. Am I right?

    Mike Stone

    ReplyDelete
    Replies
    1. Mike - you don't have a problem here. You have rejected the null that there is a unit root at ALL frequencies at once (including the zero frequency). This leaves open the possibility that there are unit roots at one or more individual frequencies (including the zero frequency), and this is what you have confirmed separately. So, yes, you conclude that there is a unit root at the zero frequency. Simple first-differencing of the series will render it stationary.

      Delete
  12. Thank you, that was the missing link!

    ReplyDelete

Note: Only a member of this blog may post a comment.