Using gret l for Principles of Econometrics, 4th Edition
Okun’s Law
Okun’s Law provides another opportunity to search for an adequate specification of the time - series model. Load the okun. gdt data. These quarterly data begin at 1985:2. Set the data structure to time-series if needed. In this example, the model search is over p = 0,1, 2 and q = 1, 2, 3. There are 12 possible models to consider and loops will again be used to search for the preferred one.
To make the loop simpler, the modelsel function has been modified slightly. It now accepts a single variable list as its input. This allows us to place the dependent variable, x, and its first lag into the model as x(0 to -1). Gretl reads this as x x(-1). Thus, these two regressions would yield the same result
ols x const x(-1) ols x(0 to -1) const
Placing the constant at the end of the list only moves its position in the output, it does not change the substance of the results.
The new and improved modelsel2 appears below:
Notice that the input on line one is now just a single variable list. Line 6 is modified by subtracting one from the number of elements in the variable list, since the list now includes the dependent variable. Also, the printf statements are commented out to reduce the amount of output sent to the screen. You can remove the # from lines 9 and 10 if you want to see what’s in the model and the results at each iteration. Since we are dealing with an ARDL(p, q), p and q tell us exactly which regressors are in the model so these are really not needed in the current context.
The new and improved loop to compute the model selection rules is:
Loop for the Okun Example
1 open "@gretldirdatapoeokun. gdt"
2 diff u
3 smpl 1986:1 2009:3
4 matrix A = {}
5 loop p = 0..2 —quiet
6 loop q = 1..3 —quiet
7 if p=0
8 list vars = d_u g(0 to - q) const
9 else
10 list vars = d_u(0 to - p) g(0 to - q) const
11 endif
12 matrix a = p~q~modelsel2(vars)
13 matrix A = A | a
14 endloop
15 endloop
16 colnames(A,"p q K N AIC SC ")
17 print A
18 function modelsel2 clear
This loop improves upon the last in at least one way. It now contains a nest that should function properly for any p>1 and q>0. The first three lines load the data, create the difference of unemployment, and set the sample to match the one used in POE4. This script contains two loops, one for p and one for q that are nested. When loops are nested this way, the p loop starts at zero and then the q loop iterates from 1 to 3. Once the q loop is finished, the p loop increments by 1 and the q loop starts over again.
The conditional if statement is necessary because when p=0 the statement d_u(0 to -p) in line 10 cannot be computed. The last line clears the modelsel2 function from memory. If you need to modify the function, perform your changes, and re-run it to load it into memory. Once loaded into memory, there is no need to run it again.
The results from this script are
p |
q |
K |
N |
AIC |
SC |
0.0000 |
1.0000 |
3.0000 |
95.000 |
-3.4362 |
-3.3556 |
0.0000 |
2.0000 |
4.0000 |
95.000 |
-3.4634 |
-3.3559 |
0.0000 |
3.0000 |
5.0000 |
95.000 |
-3.4424 |
-3.3080 |
1.0000 |
1.0000 |
4.0000 |
95.000 |
-3.5880 |
-3.4805 |
1.0000 |
2.0000 |
5.0000 |
95.000 |
-3.5675 |
-3.4331 |
1.0000 |
3.0000 |
6.0000 |
95.000 |
-3.5612 |
-3.3999 |
2.0000 |
1.0000 |
5.0000 |
95.000 |
-3.5693 |
-3.4349 |
2.0000 |
2.0000 |
6.0000 |
95.000 |
-3.5483 |
-3.3870 |
2.0000 |
3.0000 |
7.0000 |
95.000 |
-3.5491 |
-3.3609 |
The ARDL(1,1) minimizes both AIC and SC. The estimates for this model are:
OLS, using observations 1985:4-2009:3 (T = 96)
Dependent variable: d_u
HAC standard errors, bandwidth 3 (Bartlett kernel)
Coefficient |
Std. Error |
t-ratio |
p-value |
|
const |
0.378010 |
0.0671726 |
5.6275 |
0.0000 |
g |
-0.184084 |
0.0268375 |
-6.8592 |
0.0000 |
g-1 |
-0.0991552 |
0.0388520 |
-2.5521 |
0.0124 |
d_u_1 |
0.350116 |
0.0861251 |
4.0652 |
0.0001 |
An autoregressive model is just a special case of an ARDL(p, q) where q = 0. The model only includes lags of the dependent variable.
yt = 5 + diyt-i + 02yt-2------- + OpVt-p + vt (9.13)
The example is based on the okun. gdt data. An initial AR(2) model is estimated using GDP growth. The possibility of residual autocorrelation is explored using LM tests and by looking at the correlogram.
1 open "@gretldirdatapoeokun. gdt"
2 ols g(0 to -2) const
3 series res = $uhat
4 corrgm res
5 loop i = 1..4
6 modtest $i —autocorr —quiet
7 endloop
The correlogram appears in Figure 9.14 below. Only the autocorrelation at the 12th lag is significant, probably by chance. None of the LM statistics computed by the modtest loop have p-values smaller than 10%, therefore this model may be properly specified. To see how this compares with others via the model selection rules, we use another loop and the modesel2 function.
1 open "@gretldirdatapoeokun. gdt"
2 smpl 1986:3 2009:3
3 matrix A = {}
4 scalar q=0
5 loop p = 1..5 —quiet
6 list vars = g(0 to - p) const
7 matrix a = p~q~modelsel2(vars)
8 matrix A = A | a
9 endloop
10 colnames(A,"p q K N AIC SC ")
11 print A
The sample was shortened again and the nested loop is removed. Otherwise, this is the same as used to model select in the ARDL(p, q) example. The results
p |
q |
K |
N |
AIC |
SC |
1.0000 |
0.0000 |
2.0000 |
93.000 |
-1.0935 |
-1.0391 |
2.0000 |
0.0000 |
3.0000 |
93.000 |
-1.1306 |
-1.0489 |
3.0000 |
0.0000 |
4.0000 |
93.000 |
-1.1242 |
-1.0153 |
4.0000 |
0.0000 |
5.0000 |
93.000 |
-1.1332 |
-0.99700 |
5.0000 |
0.0000 |
6.0000 |
93.000 |
-1.1117 |
-0.94827 |
match those in POE4. The AR(2) model is supported by the SC while the AIC chooses one with 4 lags. As mentioned previously, the SC criterion imposes a slightly larger penalty for adding regressors and may sometimes leas to smaller models.