Using gret l for Principles of Econometrics, 4th Edition

Tests for Stationarity

The (augmented) Dickey-Fuller test can be used to test for the stationarity of your data. To perform this test, a few decisions have to be made regarding the time-series. The decisions are usually made based on visual inspection of the time-series plots. By looking at the plots you can determine whether the time-series have a linear or quadratic trend. If the trend in the series is quadratic then the differenced version of the series will have a linear trend in them. In Figure 12.1 you can see that the Fed Funds rate appears to be trending downward and its difference appears to wander around some constant amount. Ditto for bonds. This suggests that the Augmented Dickey Fuller test regressions for each of the series should contain a constant, but not a time trend.

The GDP series in the upper left side of Figure 12.2 appears to be slightly quadratic in time. The differenced version of the series that appears below it has a slight upward drift and hence I would choose an augmented Dickey-Fuller (ADF) test that included a constant and a time trend. As you may have guessed, analyzing time-series in this way is a bit like reading entrails and there is something of an art to it. Our goal is to reduce some of the uncertainty using formal tests whenever we can, but realize that choosing the appropriate test specification requires some judgement by the econometrician.

The next decision is to pick the number of lagged terms to include in the ADF regressions. Again, this is a judgement call, but the residuals from the ADF regression should be void of any autocorrelation. Gretl is helpful in this respect since it reports the outcome of an autocorrelation test whenever the built-in ADF routines are used. Below is the example from your text, where the stationarity of the Fed Funds rate and the three year bond series are explored.

To perform the ADF test on the Fed Funds rate, use the cursor to highlight the series and click Variable>Unit root tests>Augmented Dickey-Fuller test from the pull-down menu as shown in Figure 12.5 below. This brings up the dialog box shown in the next Figure, 12.6. Notice that here is where you inform gretl whether you want to include a constant, trend, trend squared, seasonal indicators, etc. We have chosen to start with a maximum lag of 4 and to allow gretl to test-down to the number of lags required. We have also chosen to perform the test two ways, one including a constant in the ADF regression and the other including a constant and trend. Also, we
have not checked the box to have gretl report the results from the regression. To make the results a bit more transparent it is often a good idea to see the regression results that generate the test statistics, and we invite you to try it for yourself.

At the bottom of the dialog you must choose whether you want to use the level or the difference of the variable. Choosing the level, as shown in the box, puts the difference on the left-hand side of the regression. This can be a bit confusing, but in reality it should not be. Remember, you are testing to see whether the levels values of the series are stationary. Choosing this box is telling gretl that you want to test the nonstationarity of the series’ levels.

If you want to check to see whether the differences are nonstationary, then click the radio button below the one indicated. Click OK and the results appear as in Figure 12.7.

The test results are quite informative. First it tells you that you one lagged value was selected (from a maximum of 4) to include in the model. It reveals that the first set of statistics is for a test based on a regression with a constant. It provides you with an estimate of 7, which it refers to as a-1, the t-ratio for 7, and the correct p-value for the statistic as computed by Davidson and MacKinnon. It also reports an estimated autocorrelation coefficient for the errors (-0.051) which should be small if you have chosen the correct number of lags in the ADF regression.

The null hypothesis of the ADF test is that the time-series has a unit root and is not stationary. If you reject this hypothesis then you conclude that the series is stationary. To not reject the null means that the level is not stationary. Here, the test statistic for the stationarity of the Fed Funds rate is -2.50482 which has a p-value of 0.1143. Nonstationarity of the Fed Funds rate can not be rejected in this case at the usual 5 or 10% levels of significance.

One more thing should be said about the ADF test results. Gretl expresses the model in a slightly different way than your textbook. The model is

(1 - L)yt = во + (a - 1)yt-1 + aiAyt_ 1 + et (12.2)

The coefficient во is included because you believe the series has a trend, (a-1) = 7 is the coefficient of interest in the Dickey-Fuller regression, and a1 is the parameter for the term that ‘augments’ the Dickey-Fuller regression. It is included to eliminate autocorrelation in the model’s errors, et, and more lags can be included if needed to accomplish this. The notation on the left side of the equation (1 - L)yt makes use of the lag operator, L. The lag operator performs the magic Lyt = yt-1. Thus, (1 - L)yt = yt - Lyt = yt - yt-1 = Ayt.

The script to perform the ADF test is:

1 open "@gretldirdatapoeusa. gdt"

2 adf 4 f —c —ct —test-down

The syntax is fairly straightforward. The first number after adf gives gretl the lag number for the ADF test. Next is the series name to test. There are three options: 1) —c tells gretl to run
the ADF regressions with a constant (when the series has a trend) 2) —ct tells gretl to run the regression with a constant and trend (the series and its difference have trends) and 3) —test-down informs gretl that you want to use the lag number 4 as a starting point and to reduce the number of lags to find the optimal model.

When testing down, gretl follows the algorithm.

1. Estimate the ADF regression with the given maximum lags, km, of the dependent variable included as regressors.

2. Gretl checks to see if the last lag significantly different from zero at the 10% level. If it is, perform the ADF test with lag order km. If the coefficient on the last lag is not significant, reduce the lag number by one, km-i = km — 1 and repeat.

3. if k1 is insignificant, execute the test with lag order 0.

You could also use model selection rules via a user written function to eliminate lags from the ADF regressions.

The adf syntax from the gretl command help is summarized:

adf

order variist

—nc (test without a constant)

—c (with constant only)

—ct (with constant and trend)

—ctt (with constant, trend and trend squared)

—seasonals (include seasonal dummy variables) —gls (de-mean or de-trend using GLS)

—verbose (print regression results)

—quiet (suppress printing of results)

—difference (use first difference of variable)

—test-down (automatic lag order) adf 0 y

adf 2 у —nc — c --ct adf 12 у — c --test-down See also jgir-1996 . inp

The augmented version of the Dickey-Fuller test adds lagged differences to the model. For the model with a constant and no trend this would be:

m

Ayt = a + YVt-i + ^ asAyt-s + vt (12.3)

s=1

You have to pick the number of lags to include. Essentially, one should include just enough lags of Ayt-s to ensure that the residuals are uncorrelated. The number of lagged terms can also be
determined by examining the autocorrelation function (ACF) of the residuals, or the significance of the estimated lag coefficients. The latter is what gretl does when you use the —test-down option. Notice that gretl also includes the autocorrelation coefficient in the output. Thus, it serves as a final check of the adequacy of your ADF regression.

In the example from POE4, the Federal Funds rate (f) and the 3-year Bond rate (b) are consid­ered. The series plots show that the data wander about, indicating that they may be nonstationary. To perform the Dickey-Fuller tests, first decide whether to use a constant and/or a trend. Since the levels of the series fluctuate around a nonzero mean and the differences around zero, we include a constant. Then decide on how many lagged difference terms to include on the right-hand side of the equation. You can also use the model selection rules described in chapter 9, to choose lags for the ADF.

To use this method as a means of model selection, we have to return to our modelsel2 function and estimate the ADF regressions manually. The model selection function is shown below:

------------------------- Model Selection function ----------------

1 function matrix modelsel2 (list xvars)

2 ols xvars —quiet

3 scalar sse = $ess

4 scalar N = $nobs

5 scalar K = nelem(xvars)-1

6 scalar aic = ln(sse/N)+2*K/N

7 scalar bic = ln(sse/N)+K*ln(N)/N

8 matrix A = { K, N, aic, bic}

9 % printf "nDependent variable and Regressors: %sn",varname(xvars)

10 % printf "K = %d, N = %d, AIC = %.4f SC = %.4f.n",K, N,aic, bic

11 return A

12 end function

This is exactly the same version of the model selection function used in chapter 9. Refer to page 217 for details. We will use it in a loop to select lag lengths for the ADF regressions.

The ADF regressions require only a single loop over the lagged differences in the series. The loop is:

1 diff b

2 matrix A = {}

3 loop p = 1..4 —quiet

4 list vars = d_b(0 to - p) b(-1) const

5 matrix a = p~modelsel2(vars)

6 matrix A = A | a

7 endloop

8 colnames(A,"p K N AIC SC ")

9 print A

The matrix result is:

p

K

N

AIC

SC

1.0000

3.0000

104.00

-1.3674

-1.2911

2.0000

4.0000

104.00

-1.3544

-1.2527

3.0000

5.0000

104.00

-1.4241

-1.2970

4.0000

6.0000

104.00

-1.4291

-1.2765

The AIC is minimized at 4 lags and the SC at 3.

Finally, here is a way to automate the model selection process for an arbitrary time-series. We want to be able to feed the modelsel2 function the name of a time-series to compute an ADF regression. We'll create another function that has two inputs; one for the maximum lag over which to search and another for the name of the series. The loop will create the differences, generate the variable list needed to estimate a ADF regression that contains a constant, send the list to the modelsel2 routine, and collect its output into a matrix, and print the matrix. It is fairly simple, but effective.

1 function scalar modelseladf (scalar p, series *y)

2 diff y

3 matrix A = {}

4 loop i = 1..p —quiet

5 list vars = d_y(0 to - i) y(-1) const

6 matrix a = i~modelsel2(vars)

7 matrix A = A | a

8 endloop

9 colnames(A,"p K N AIC SC ")

10 print A

11 return 0

12 end function

The return is a scalar that will be equal to zero, provided everything in the function is executed. The other small difference is that a pointer to the series is used instead of the series itself. This is mainly a way to save some memory and is not strictly necessary. The pointer to the series input in the function is preceded by a *. To call the function to get model selection statistics for the inflation series use

modelseladf(5, &inf)

Because we used a pointer in the function, the series (inf) has to be preceded by the ampersand (&). The output is printed to the screen:

modelseladf(5, &inf) A (5 x 5)

p

K

N

AIC

SC

1.0000

3.0000

104.00

-1.0233

-0.94704

2.0000

4.0000

104.00

-1.0257

-0.92404

3.0000

5.0000

104.00

-1.0906

-0.96351

4.0000

6.0000

104.00

-1.2439

-1.0914

5.0000

7.0000

104.00

-1.3028

-1.1248

The inflation series appears to have longer lags than the two interest rate series. AIC and SC are minimized at 5 lags. Schwert (1989) proposed that for N > 100 the maximum lag be set to kmax = int[12(T + 1)/100]0'25. If your sample is smaller then use kmax = int[4(T + 1)/100]0'25.[75]

Once you are finished with these functions you can use the function modelsel2 modelseladf clear command to remove them from memory.

Добавить комментарий

Using gret l for Principles of Econometrics, 4th Edition

Simulation

In appendix 10F of POE4, the authors conduct a Monte Carlo experiment comparing the performance of OLS and TSLS. The basic simulation is based on the model y = x …

Hausman Test

The Hausman test probes the consistency of the random effects estimator. The null hypothesis is that these estimates are consistent-that is, that the requirement of orthogonality of the model’s errors …

Time-Varying Volatility and ARCH Models: Introduction to Financial Econometrics

In this chapter we’ll estimate several models in which the variance of the dependent variable changes over time. These are broadly referred to as ARCH (autoregressive conditional heteroskedas - ticity) …

Как с нами связаться:

Украина:
г.Александрия
тел./факс +38 05235  77193 Бухгалтерия

+38 050 457 13 30 — Рашид - продажи новинок
e-mail: msd@msd.com.ua
Схема проезда к производственному офису:
Схема проезда к МСД

Партнеры МСД

Контакты для заказов оборудования:

Внимание! На этом сайте большинство материалов - техническая литература в помощь предпринимателю. Так же большинство производственного оборудования сегодня не актуально. Уточнить можно по почте: Эл. почта: msd@msd.com.ua

+38 050 512 1194 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.