# Selecting Lag Length

The second consideration is the specification of lags for the ADF regressions. There are several ways to select lags and gretl automates one of these. The basic concept is to include enough lags in the ADF regressions to make the residuals white noise. These will be discussed presently.

The first strategy is to include just enough lags so that the last one is statistically significant. Gretl automates this using the —test-down option for the augmented Dickey-Fuller regressions. Start the ADF regressions with a generous number of lags and gretl automatically reduces that number until the t-ratio on the longest remaining lag is significant at the 10 percent level. For the levels series we choose the maximum number using Schwert’s method as discussed in chapter 12. The model includes a constant, trend, and trend squared (—ctt option), and use the —test-down option.

1 scalar mlag = int(12*(($nobs+1)/100)"(0.25))

2 adf mlag usa —ctt —test-down

3 adf mlag aus —ctt —test-down

The USA series contains a very long significant lag twelve periods into the past. The Australian series shows much less persistence, choosing only 3 in testing down from 12. The result is shown in Figure 13.2. Both ADF statistics are insignificant at the 5% or 10% level, indicating they are nonstationary. This is repeated for the differenced series using the commands:

adf mlag diff(usa) —ct —test-down adf mlag diff(aus) —ct —test-down

The selected lags for the U. S. and Australia are eleven and seven, respectively. Both ADF statistics are significant at the 5% level and we conclude that the differences are stationary.

Testing Up

The other strategy is to test the residuals from the augmented Dickey-Fuller regressions for autocorrelation. In this strategy you can start with a small model, and test the residuals of the Dickey-Fuller regression for autocorrelation using an LM test. If the residuals are autocorrelated, add another lagged difference of the series to the ADF regression and test the residuals again. Once the LM statistic is insignificant, you quit you are done. This is referred to as testing-up. You will still need to start with a reasonable number of lags in the model or the tests will not have desirable properties.

To employ this strategy in gretl, you’ll have to estimate the ADF equations manually using the ols command. Since the data series has a constant and quadratic trend, you have to define a time trend (genr time) and possibly trend squared (square time) to include in the regressions.[77]

witln constant and quadratic trend

model: (l-L)y = ЬО + bl*t + b2*t~2 + (a-l)*y(-l) + … + e

lst-order autocorrelation coeff. for e: 0.005

lagged differences: F(12, Э5) = 3.170 [0.0008]

estimated value of (a – 1): -0.12Э066

test statistic: tau_ctt(1) = -2.47237

asymptotic p-value 0.5843

? adf mlag aus —ctt —test-down |

witln constant and quadratic trend

model: (l-L)y = b0 + bl*t + b2*t~2 + (a-l)*y(-l) + … + e

lst-order autocorrelation coeff. for e: 0.028

lagged differences: F(3, 113) = 2.543 [0.0598]

estimated value cf fa – 11: -0.157192

test statistic: tau_ctt(1) = -3.32732

asymptotic p-value 0.163

Figure 13.2: Based on ADF tests, the levels of Australian and U. S. GDP are nonstationary.

Note this is another one of those cases where you cannot use series in place of genr. The genr time is a special function for genr. The other cases include genr dummy and genr unitdum. You will also need to generate the differences to use in a new function called lags. The script to do this follows:

1 genr time

2 square time

3 diff usa aus

Now, estimate a series of augmented Dickey-Fuller regressions using ols. Follow each regression with the LM test for autocorrelation of the residuals discussed in chapter 9.

1 loop i=1..12

2 ols d_usa(0 to – i) usa(-1) const time sq_time —quiet

3 printf "ADF lag order = %dn",i

4 modtest 1 —autocorr —quiet

5 end loop

In this code example we chose to suppress the results from the first regression so that the output from the tests would fit on one page (Figure 13.3). In practice, you could skip this option and read the Dickey-Fuller t-ratio directly from the output. The only disadvantage of this is that the proper p-value for it is not computed using the manual approach.

If you repeat this exercise for aus (as we have done in the script at the end of the chapter[78]) you will find that testing up determines zero lags of d_aus are required in the Dickey-Fuller regression; testing down revealed three lags were needed. The incongruence occurs because we did a poor job of testing up, failing to include enough autocorrelation terms in the LM test. This illustrates a danger of testing up. When we conducted the LM test using only a single autocorrelation term, we had not searched far enough in the past to detect significant autocorrelations that lie further back in time. Adding terms to the autocorrelation test using modtest 3 —autocorr would have helped to detect this.

## Leave a reply