Using gret l for Principles of Econometrics, 4th Edition
Autoregressive Distributed Lag Models
A model that combines finite distributed lags and is autoregressive is considered. This is the so-called autoregressive distributed lag model (ARDL). The ARDL(p, q) model has the general form
yt = 5 + Qiyt-i +------- + OpVt-p + 5oXt + 5ixt-i +----- + 5q xt-q + vt (9.12)
The ARDL(1,1) and ARDL(1,0) models of inflation can be estimated using least squares. The two models of the Phillips curve
OLS estimates
Dependent variable: inf
(1) |
(2) |
|
const |
0.3336** |
0.3548** |
(0.08990) |
(0.08760) |
|
inf_1 |
0.5593** |
0.5282** |
(0.09080) |
(0.08508) |
|
d_u |
-0.6882** |
0.4909** |
(0.2499) |
(0.1921) |
|
d_u_1 |
0.3200 (0.2575) |
|
n |
89 |
90 |
0.3260 |
0.3314 |
|
і |
66.39 |
-67.45 |
Standard errors in parentheses * indicates significance at the 10 percent level ** indicates significance at the 5 percent level
Choosing between these models can be done in several ways. First, if the t-ratio on Aut-1 is insignificant, then the evidence suggests that omitting it may not adversely impact the properties of the least squares estimator of the restricted model. it is not significant in this case and you may consider dropping it from the model.
Another possibility is to use one of the model selection rules discussed in chapter 6. Recall that we wrote a function called modelsel that computes the AIC and SC model selection rules. Here, the program is modified slightly by omitting the display of the adjusted R2. Refer to chapter 6 for more details on the program structure in gretl.
To choose between the ARDL(1,1) and ARDL(1,0) using the AIC or SC create and run the following function called modelsel.
і |
function matrix modelsel (series y, list xvars |
|
2 |
ols y xvars —quiet |
|
3 |
scalar |
sse = $ess |
4 |
scalar |
N = $nobs |
5 |
scalar |
K = nelem(xvars) |
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 |
"nRegressors: %sn",varname(xvars) |
10 |
printf |
"K = %d, N = %d, AIC = %.4f SC = %.■ |
іі |
return |
A |
12 |
end function |
Then, we can form variable lists and use the function to compare two models:
3 list x = const inf(-1) d_u(0)
4 matrix b = modelsel(inf, x)
This yields
Regressors: const, inf_1,d_u, d_u_1 K = 4, N = 91, AIC = -1.2802 SC = -1.1698.
Regressors: const, inf_1,d_u K = 3, N = 91, AIC = -1.2841 SC = -1.2013.
The smaller model (K = 3) has a smaller AIC and SC and it is preferred.
We could also search over a wider range of models using loops. Searching over p = 1,2,... 6 and q = 0,1 is done in the next section of code. Admittedly, this is a little clumsy in that formulating a set of nested loops for this setup is not straightforward in gretl due to the fact that it cannot recognize variables like inf(0 to 0). This causes one to have to hard code certain parts and use a series of if statements to control the construction of the variable lists.[70] The code to search over this set is:
1 open "@gretldirdatapoephillips_aus. gdt"
2 diff u
3 smpl 1988:3 2009:3
4 matrix A = {}
5 scalar q = 0
6 loop p = 1..6 —quiet
7 if p = 1
8 list x = const inf(-1) d_u
9 else
10 list x = const inf(-1 to - p) d_u
11 endif
12 matrix a = p~q~modelsel(inf, x)
13 matrix A = A | a
14 modelsel(inf, x)
15 endloop
16 scalar q = 1
17 loop p = 1..6 --quiet
18 if p = 1
19 list x = const inf(-1) d_u(0 to -1)
20 else
21 list x = const inf(-1 to - p) d_u(0 to -1)
22 endif
23 matrix a = p~q~modelsel(inf, x)
24 matrix A = A | a
26 colnames(A,"p q K N AIC SC ")
27 print A
The data are loaded and the differences of unemployment are generated using the diff command. Then, the sample is limited to 1988:3 - 2009:3 in order to get the same results as found in Table 9.4 of POE4. An empty matrix A is created. This matrix will be used to collect results of the modelsel command. To do this, the row vectors created by modelsel will be vertically concatenated. That means as a new row will be appended below existing rows. If the matrix starts out empty the first row appended becomes the first row!
As I mentioned above, some of the variables are hard coded into the loop. In this example the distributed lag parameter, q, only takes two values, 0 and 1. In the first loop q is hard coded to be equal to zero. So, the loop is executed with the variable Aut permanently in the variable list named x.
The loop itself loops over the parameter p, which starts at 1 increments to 6. When p=1, the syntax inf(-1 to -1) fails so we must tell gretl to construct the variable list x with inf(-1) when p=1. Otherwise we can construct the variable list using inf(-1 to -$p).
In line 12 a row vector is created that includes p, q, and the results from modelsel. This uses horizontal concatenation via the symbol, ~. In the next line vertical concatenation is used to stack the new vector of results underneath the existing ones. The loop ends and column names are added to the matrix and printed.
The next loop is nearly identical. The only difference is that q=1 is hard coded into the script. Notice that q=1 is fixed as a scalar in line and that d_u(0 to -1) replaces d_u in the previous loop. So, the code looks complicated, but it can effectively be replicated by a cut and paste with minor editing. In this particular script, p and q are actually numbers that work in this loop construct. Hence, there is no need to use the string prefix, $ (although if used in lines 10 and 12 this will work as well).
That is a lot of code, but the output is nice:
p |
q |
K |
N |
AIC |
SC |
1.0000 |
0.0000 |
3.0000 |
85.000 |
-1.2466 |
-1.1604 |
2.0000 |
0.0000 |
4.0000 |
85.000 |
-1.2905 |
-1.1755 |
3.0000 |
0.0000 |
5.0000 |
85.000 |
-1.3352 |
-1.1915 |
4.0000 |
0.0000 |
6.0000 |
85.000 |
-1.4020 |
-1.2296 |
5.0000 |
0.0000 |
7.0000 |
85.000 |
-1.3964 |
-1.1952 |
6.0000 |
0.0000 |
8.0000 |
85.000 |
-1.3779 |
-1.1480 |
1.0000 |
1.0000 |
4.0000 |
85.000 |
-1.2425 |
-1.1275 |
2.0000 |
1.0000 |
5.0000 |
85.000 |
-1.2860 |
-1.1423 |
3.0000 |
1.0000 |
6.0000 |
85.000 |
-1.3233 |
-1.1509 |
4.0000 |
1.0000 |
7.0000 |
85.000 |
-1.3795 |
-1.1784 |
5.0000 |
1.0000 |
8.0000 |
85.000 |
-1.3729 |
-1.1430 |
6.0 1.0000 9.0000 85.000 -1.3544 -1.0958
From this you can see that the ARDL(4,0) minimizes both AIC and SC. Estimating this model yields,
OLS, using observations 1988:1-2009:3 (T = 87)
Dependent variable: inf
Coefficient |
Std. Error |
t-ratio |
p-value |
|
const |
0.100100 |
0.0982599 |
1.0187 |
0.3114 |
d_u |
-0.790172 |
0.188533 |
-4.1912 |
0.0001 |
inf_1 |
0.235440 |
0.101556 |
2.3183 |
0.0230 |
inf_2 |
0.121328 |
0.103757 |
1.1693 |
0.2457 |
inf_3 |
0.167690 |
0.104960 |
1.5977 |
0.1140 |
inf_4 |
0.281916 |
0.101380 |
2.7808 |
0.0067 |
18.23336 S. E. of regression 0.458422 Adjusted R2 13.71262 P-value(F) -55.47215 Akaike criterion 137.7397 Hannan-Quinn -0.032772 Durbin’s h
Finally, you can check the residuals for autocorrelation using the LM test. Here we want to check the model for autocorrelation for up to 5 lags. The easiest way is to put modtest into a loop. The underlying regression is an ARDL(1,0). This one wins the model selection derby because the coefficient on Ди;_1 was not significant in and ARDL(1,1).
1 open "@gretldirdatapoephillips_aus. gdt"
2 diff u
3 ols inf inf(-1) d_u const
4 loop i=1..4
5 modtest $i —autocorr —quiet
6 endloop
This is an example of an index loop. The index is called i and it loops in increments of 1 from 1 to 4. The modtest command takes the string argument $i at each iteration. The —quiet option is used to reduce the copious amount of output this loop will produce. The p-values for the LM test, which I’ve chosen not to include, match the ones Table 9.3 of POE4.