<<

Here is an example where I analyze the lags needed to analyze Okun’s Law.

open okun gnuplot g u --with-lines --time-series

These look stationary.

Next, we’ll take a look at the first 15 for the two series. corrgm diff(u) 15 corrgm g 15

These are autocorrelated

and so are these. I would expect that a simple regression will not be sufficient to model this relationship. Let’s try anyway.

Run a simple regression and look at the residuals ols diff(u) const g series ehat=$uhat gnuplot ehat --with-lines --time-series

These look positively autocorrelated to me. Notice how the residuals fall below zero for a while, then rise above for a while, and repeat this pattern. Take a look at the .

The first is significant. More lags of D.u or g will probably fix this.

LM test of residuals smpl 1985.2 2009.3 ols diff(u) const g modeltab add modtest 1 --autocorr --quiet modtest 2 --autocorr --quiet modtest 3 --autocorr --quiet modtest 4 --autocorr --quiet

Breusch-Godfrey test for first-order autocorrelation Alternative : TR^2 = 6.576105, with p-value = P(Chi-square(1) > 6.5761) = 0.0103

Breusch-Godfrey test for autocorrelation up to order 2 Alternative statistic: TR^2 = 7.922218, with p-value = P(Chi-square(2) > 7.92222) = 0.019

Breusch-Godfrey test for autocorrelation up to order 3 Alternative statistic: TR^2 = 11.200978, with p-value = P(Chi-square(3) > 11.201) = 0.0107

Breusch-Godfrey test for autocorrelation up to order 4 Alternative statistic: TR^2 = 11.220956, with p-value = P(Chi-square(4) > 11.221) = 0.0242

Yep, that’s not too good. Significant lags (jointly tested at 5%) up through 4. See that the p-values are all less than .05. This regression clearly needs work.

Add a couple of lags to g (finite distributed lag model) and repeat. reg D.u L(0/3).g estat bgodfrey, lags(1 2 3 4)

Model 3: OLS, using observations 1986:1-2009:3 (T = 95) Dependent variable: d_u

coefficient std. error t-ratio p-value ------const 0.580975 0.0538893 10.78 6.92e-018 *** g -0.202053 0.0330131 -6.120 2.39e-08 *** g_1 -0.164535 0.0358175 -4.594 1.41e-05 *** g_2 -0.0715560 0.0353043 -2.027 0.0456 ** g_3 0.00330302 0.0362603 0.09109 0.9276

Mean dependent var 0.027368 S.D. dependent var 0.289329 Sum squared resid 2.735164 S.E. of regression 0.174329 R-squared 0.652406 Adjusted R-squared 0.636957 F(4, 90) 42.23065 P-value(F) 6.77e-20 Log-likelihood 33.71590 Akaike criterion -57.43179 Schwarz criterion -44.66241 Hannan-Quinn -52.27200 rho 0.358631 Durbin-Watson 1.274079

Breusch-Godfrey LM test for autocorrelation ------lags(p) | chi2 df Prob > chi2 ------+------1 | 12.638 1 0.0004 2 | 13.152 2 0.0014 3 | 13.725 3 0.0033 4 | 15.191 4 0.0043 ------H0: no serial correlation

The last lag on g is not significant but the residuals are still autocorrelated. I suspect that the model is autoregressive. Add a lag of Du. In doing so, we should be able to reduce the order of the distributed lag.

Model 4: OLS, using observations 1985:4-2009:3 (T = 96) Dependent variable: d_u

coefficient std. error t-ratio p-value ------const 0.378010 0.0578398 6.535 3.47e-09 *** g -0.184084 0.0306984 -5.997 3.91e-08 *** g_1 -0.0991552 0.0368244 -2.693 0.0084 *** d_u_1 0.350116 0.0845730 4.140 7.69e-05 ***

Mean dependent var 0.025000 S.D. dependent var 0.288736 Sum squared resid 2.422724 S.E. of regression 0.162277 R-squared 0.694101 Adjusted R-squared 0.684126 F(3, 92) 69.58413 P-value(F) 1.40e-23 Log-likelihood 40.39577 Akaike criterion -72.79155 Schwarz criterion -62.53415 Hannan-Quinn -68.64534 rho -0.024372 Durbin's h -0.419594

Breusch-Godfrey test for first-order autocorrelation Alternative statistic: TR^2 = 0.169654, with p-value = P(Chi-square(1) > 0.169654) = 0.68

Breusch-Godfrey test for autocorrelation up to order 2 Alternative statistic: TR^2 = 0.271347, with p-value = P(Chi-square(2) > 0.271347) = 0.873

Breusch-Godfrey test for autocorrelation up to order 3 Alternative statistic: TR^2 = 3.896381, with p-value = P(Chi-square(3) > 3.89638) = 0.273

Breusch-Godfrey test for autocorrelation up to order 4 Alternative statistic: TR^2 = 6.140635, with p-value = P(Chi-square(4) > 6.14064) = 0.189

Bingo. ARDL(1,1). This looks pretty good.

Finally, take a last look at the correlogram of the residuals.

And plotting the residuals: gnuplot ehat --with-lines --time-series --output=display

COMPLETE CODE open okun gnuplot g u --with-lines --time-series corrgm diff(u) 15 corrgm g 15 ols diff(u) const g series ehat=$uhat gnuplot ehat --with-lines --time-series --output=display corrgm ehat smpl 1985.2 2009.3 ols diff(u) const g modeltab add modtest 1 --autocorr --quiet modtest 2 --autocorr --quiet modtest 3 --autocorr --quiet modtest 4 --autocorr --quiet ols diff(u) const g(0 to -3) modeltab add modtest 1 --autocorr --quiet modtest 2 --autocorr --quiet modtest 3 --autocorr --quiet modtest 4 --autocorr --quiet ols diff(u) const g(0 to -1) d_u(-1) modeltab add series ehat = $uhat modtest 1 --autocorr --quiet modtest 2 --autocorr --quiet modtest 3 --autocorr --quiet modtest 4 --autocorr --quiet modeltab show corrgm ehat gnuplot ehat --with-lines --time-series --output=display