Page 1 of 1

ADFAutoSelect - Selection of Lag Length for ADF Test

PostPosted: Fri Aug 29, 2008 10:00 am
by TomDoan
Attached is a procedure for selecting or aiding in the selection of the number of lags in an ADF test. It offers four different criteria for selection, and (optionally) can produce a table which includes all of them, or it can (silently) choose the lag length based upon a specific choice for the criterion. However, it is not so much designed for producing a final ADF test as it is for choosing the lag length for use in later calculations. The table produced by the TABLE option includes the ADF test, but this is an ADF test using only the data range permitted by the maximum number of lags, not the range that would be used for an ADF test for that specific number of lags. If you're just trying to do an ADF test and you know which selection criterion you want to use, use the @DFUNIT procedure (http://www.estima.com/forum/viewtopic.php?f=7&t=1257) instead.

adfautoselect.src
Procedure file (requires RATS 7.3 or later)
(4.8 KiB) Downloaded 50 times


@ADFAutoSelect( options ) series start end

Options

DET=NONE/[CONSTANT]/TREND
Chooses the deterministic components

MAXLAG=maximum number of lags to consider [Schwert's 12(n/100)**.25]
MINLAG=minimum number of lags to consider [0]

CRIT=[AIC]/BIC/HQ/MAIC
Criterion to use in selecting lag length. AIC is Akaike IC, BIC is Schwarz Bayesian IC, HQ is Hannan-Quinn and MAIC is Perron and Ng's modified AIC.

YD=(input) GLS detrended series [not used]

PRINT/[NOPRINT] Prints a table for the various criteria
TITLE=title of report ["Information Criteria for ADF Lag Lengths"]

Variables Defined

%%LAGS chosen number of lags
%%AUTOP chosen number of lags (also)
%CDSTAT ADF test statistic at the chosen lag


Example

Code: Select all
*
* Greene, Econometric Analysis, 6th Edition
* Example 22.3 and 22.4 from pp 754-756
*
open data tablef5-1.txt
calendar(q) 1950
data(format=prn,org=columns) 1950:01 2000:04 year qtr realgdp realcons $
 realinvs realgovt realdpi cpi_u m1 tbilrate unemp pop infl realint
*
set loggdp  = log(realgdp)
*
* ADFAutoSelect does a sequence of DF tests and displays a table of
* criteria which can be used to select the lag length. The final column
* has the test statistic. This differs from the one in the stand-alone
* DFUNIT because ADFAutoSelect uses only the data points allowed when 14
* lags are included, while DFUNIT (by default), uses the maximum range
* allowed with the number of lags used on it.
*
@adfautoselect(maxlags=14,det=trend,print) loggdp
@dfunit(lags=1,det=trend) loggdp
*
@ppunit(lags=4,det=trend) loggdp
*
* KPSS test (example 22.4)
*
@kpss(lags=10,det=constant) loggdp
@kpss(lags=10,det=trend) loggdp


Sample Output

Code: Select all
Information Criteria for ADF Lag Lengths, Series LOGGDP
Lags AIC      BIC      HQ       MAIC     ADF
   0  -9.274   -9.223   -9.253   -9.275   -1.700
   1  -9.399   -9.330*  -9.371*  -9.365   -2.444
   2  -9.400*  -9.315   -9.366   -9.351   -2.674
   3  -9.391   -9.288   -9.350   -9.348   -2.513
   4  -9.386   -9.266   -9.338   -9.353   -2.301
   5  -9.389   -9.251   -9.333   -9.368*  -2.024
   6  -9.382   -9.228   -9.320   -9.354   -2.129
   7  -9.372   -9.200   -9.302   -9.344   -2.091
   8  -9.362   -9.173   -9.285   -9.337   -2.007
   9  -9.357   -9.151   -9.273   -9.324   -2.128
  10  -9.347   -9.124   -9.257   -9.310   -2.167
  11  -9.337   -9.097   -9.240   -9.304   -2.079
  12  -9.343   -9.085   -9.238   -9.323   -1.822
  13  -9.334   -9.060   -9.223   -9.318   -1.733
  14  -9.326   -9.035   -9.208   -9.307   -1.789

Re: ADFAutoSelect - Revised

PostPosted: Mon Sep 21, 2009 9:21 pm
by Anna
Hey Tom,

I am a little bit confused after using ADFAutoselect (downloaded from the normal website, not from here, but seems to be the same version). For a series of time series, the ADFAutoselect reports optimal k for the MAIC that are often smaller than the values for the AIC. But this cannot be. Having looked at the simulation results of Perron and Ng, they never reported smaller values for the MAIC, which is in line with the intuition since the MAIC punishes a too short lag-length as well.

Did I make anything wrong? Or do I interpret the output incorrectly? Or is there any error in the code?

Best wishes
Anna

Re: ADFAutoSelect - Revised

PostPosted: Tue Sep 22, 2009 10:47 am
by TomDoan
The MAIC was really designed to work with data that have had the deterministic components removed. I revised the version above to correct for that, so it should give better results for DET=CONSTANT and DET=TREND.

However, you're not correct that MAIC can't pick a model smaller than AIC. First, all those simulations are done under the assumption that the input series is a random walk with stationary noise. If that's not true, it's not clear what the effect will be. Also, those are medians over large number of simulations; they don't indicate what happens with any particular data set. Finally, one of the simulations in Perron and Rodriguez does comes out with MAIC choosing a smaller lag length (on average) than AIC.

The MAIC correction adds in a product of three factors, one of which (b(0)^2) doesn't vary monotonically with the number of lags, so it's not entirely clear whether it will increase or decrease the penalty for lags.

Re: ADFAutoSelect - Revised

PostPosted: Tue Sep 22, 2009 1:17 pm
by Anna
Ok, thanks for that. Really appreciated.

However, even with that revised version, the optimal choice of the lag-truncation parameter k chosen by AIC is always at least as high as the MAIC value but most often higher, regardless of the specification for the deterministic components. I have run this on 5 different typical time series, all of which are clearly I(1), and for all choices of deterministics. It somehow seems counterintuitive for me that this happens all the time in my sample, given that the MAIC was developed to overcome the problem that the AIC typically chooses too small values. However, it is probably a small sample fallacy...

Re: ADFAutoSelect - Revised

PostPosted: Tue Sep 22, 2009 1:39 pm
by TomDoan
Actually, it was really aimed at one specific (and fairly rare) case, which is where the stationary component has a high negative serial correlation. The standard AIC (and the other standard criteria) tend to cut off lags very quickly in that case, producing very poor behavior for the unit root test. Ordinarily the rap against AIC is that it tends to choose too many lags (relative to the more conservative BIC and HQ).