options crt; ? 10e5 in lucas; freq a; smpl 29,65; y1 = log(n/pop); y2 = log(ql*n/rgnp); y3 = log(hw); y4 = log(hw/ql); x2 = log(rgnp/pop); x3 = log(ql); smpl 30,65; x1 = log(pgnp/pgnp(-1)); x4 = log(rgnp/rgnp(-1)); y5 = log(hw/hw(-1)); title 'Exercise 5, part (a)'; regopt(lmlags=2) ; ? turn on Breusch-Godfrey LM AR test olsq y3 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1); ? (10.41) resy3 = @res; copy @dhalt dm3a; ? note: "Durbin's h alternative" = "Durbin's m" copy @lmar2 bg3a; olsq y1 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1); ? (10.42) resy1 = @res; copy @dhalt dm1a; ? same as @lmar1, by the way copy @lmar2 bg1a; regopt(lmlags=0); ? turn off automatic B-G tests ? Note: the Durbin-Watson is not completely inappropriate for ? testing for serial correlation with lagged dependent variables. ? Although it is biased towards 2 (and its P-value is biased towards 1), ? it usually has more power than Durbin's h and Durbin's m (h alternative). ? So it can sometimes still detect serial correlation when h and m do ? not find it. However, it is still true that a large DW (and large ? P-value) do not mean that one should conclude that rho=0. title "Exercise 5, part (b) - Durbin's m"; ? use " when title contains ' . smpl 31,65; olsq(silent) resy3 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1) resy3(-1); set dm3 = @t(9); print dm3,dm3a; cdf dm3; olsq(silent) resy1 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1) resy1(-1); set dm1 = @t(9); print dm1,dm1a; cdf dm1; title 'Exercise 5, part (c) - Breusch-Godfrey LM AR test'; smpl 32,65; olsq(silent) resy3 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1) resy3(-1) resy3(-2); ? use ANALYZ to compute F-test and chi-squared test frml r1 resy3(-1); frml r2 resy3(-2); analyz r1 r2; print @wald bg3a; olsq(silent) resy1 c y3(-1) x1 x2 x3 y2(-1) x4 y1(-1) resy1(-1) resy1(-2); frml r1 resy1(-1); frml r2 resy1(-2); analyz r1 r2; print @wald bg1a; title 'Exercise 5, part (d) - Breusch-Godfrey LM in 2SLS'; smpl 30,65; list ivs c x1-x4 y1(-1) y2(-1) y3(-1); 2sls(inst=ivs) y1 c y3 y3(-1) x1 y1(-1); copy @res res1; 2sls(inst=ivs) y2 c y4 y2(-1) x4; copy @res res2; 2sls(inst=ivs) U c x1 y5 U(-1); copy @res res3; smpl 31,65; list iv2 ivs ivs(-1); ? ivs(-1) applies lags to all the variables in ivs 2sls(inst=iv2) res1 res1(-1) c y3 y3(-1) x1 y1(-1); cdf @t(1); 2sls(inst=iv2) res2 res1(-1) c y4 y2(-1) x4; cdf @t(1); 2sls(inst=iv2) res3 res1(-1) c x1 y5 U(-1); cdf @t(1);