options crt; name armax7 "Reproduce Pindyck & Rubinfeld ARMAX results (pp.554-560)" ; ? ? This example illustrates the estimation of a Transfer Function ? Model (ARMA with right hand side predetermined variables). ? The example is given in the Third Edition of Pindyck and Rubinfeld, ? pages 554-560. ? ? TSP 4.3 (September 1995) ? Author: Clint Cummins ? freq m; smpl 59:1 88:6; load; smpl 59:2 88:6; ? fygm3 is the 3 month T-bill rate. inf = log(pw/pw(-1)); ? PPI growth rate. gip = log(ip/ip(-1)); ? Industrial production index growth. gm = log(fm1/fm1(-1)); ? M1 growth rate. smpl 60:1 88:6; ols fygm3 c gm(-1) ip(-1) gip(-1) inf(-1)-inf(-4); ? unmake @coef alpha b1-b7; frml equ u = fygm3 - (alpha + b1*gm(-1) + b2*ip(-1) + b3*gip(-1) + b4*inf(-1) + b5*inf(-2) + b6*inf(-3) + b7*inf(-4) ); copy @res u; copy @smpl usmpl; smpl 88:1 88:6; plot (device=char) fygm3 y @fit p; ? ? ARMA(12,2) estimation. See the following reference for the method. ? Andrew Harvey, The Econometric Analysis of Time Series (1993), p.273. ? list bnames phi1-phi12 theta1-theta2 alpha b1-b7; param bnames; Param PHI1 1.51942 PHI2 -1.48756 PHI3 1.02639 PHI4 -.454318 PHI5 .566585 PHI6 -.649782 PHI7 .509403 PHI8 -.211461 PHI9 .208973 PHI10 -.219305 PHI11 .219001 PHI12 -.066680 THETA1 -.423494 THETA2 .744002 ; ? from ARMA(12,2) on U mmake b bnames; ? ? The above starting values yield a failure to improve after ? 15 iterations, with SSR = 72.91861 and RSQ = .97384 . ? ? Try the MicroTSP results as starting values (to try to verify their ? SSR of 72.84838). TSP gets 72.86518 from these starting values. ? From these starting values, TSP uses 41 more iterations, to yield ? SSR = 71.96000, which is better. ? mmake b 1.1772271 -.1137702 -.1876244 .0429768 .1803851 -.2845974 .0247142 .2843771 .0207156 -.1959623 .0392602 .0081196 .2140103 -.2755441 -17.735207 13.974195 .1779367 -8.0316065 9.0408316 6.7157396 6.2660084 -3.3522356 ; unmake b bnames; smpl usmpl; genr equ; ? ? Equation for disturbance. frml eqe e = u - phi1*u(-1) - phi2*u(-2) - phi3*u(-3) - phi4*u(-4) - phi5*u(-5) - phi6*u(-6) - phi7*u(-7) - phi8*u(-8) - phi9*u(-9) - phi10*u(-10) - phi11*u(-11) - phi12*u(-12) - theta1*e(-1) - theta2*e(-2); ? Equations for derivatives of disturbance wrt parameters. frml d1 dedp1 = -u(-1) - theta1*dedp1(-1) - theta2*dedp1(-2); frml d2 dedp2 = -u(-2) - theta1*dedp2(-1) - theta2*dedp2(-2); frml d3 dedp3 = -u(-3) - theta1*dedp3(-1) - theta2*dedp3(-2); frml d4 dedp4 = -u(-4) - theta1*dedp4(-1) - theta2*dedp4(-2); frml d5 dedp5 = -u(-5) - theta1*dedp5(-1) - theta2*dedp5(-2); frml d6 dedp6 = -u(-6) - theta1*dedp6(-1) - theta2*dedp6(-2); frml d7 dedp7 = -u(-7) - theta1*dedp7(-1) - theta2*dedp7(-2); frml d8 dedp8 = -u(-8) - theta1*dedp8(-1) - theta2*dedp8(-2); frml d9 dedp9 = -u(-9) - theta1*dedp9(-1) - theta2*dedp9(-2); frml d10 dedp10 = -u(-10) - theta1*dedp10(-1) - theta2*dedp10(-2); frml d11 dedp11 = -u(-11) - theta1*dedp11(-1) - theta2*dedp11(-2); frml d12 dedp12 = -u(-12) - theta1*dedp12(-1) - theta2*dedp12(-2); frml d13 dedt1 = -e(-1) - theta1*dedt1(-1) - theta2*dedt1(-2); frml d14 dedt2 = -e(-2) - theta1*dedt2(-1) - theta2*dedt2(-2); ?ols fygm3 c gm(-1) ip(-1) gip(-1) inf(-1)-inf(-4); frml d15 deda = -1+phi1+phi2+phi3+phi4+phi5+phi6+ phi7+phi8+phi9+phi10+phi11+phi12 - theta1*deda(-1) - theta2*deda(-2); frml d16 dedb1 = -gm(-1)+phi1*gm(-2)+phi2*gm(-3)+phi3*gm(-4)+phi4*gm(-5) +phi5*gm(-6)+phi6*gm(-7)+phi7*gm(-8)+phi8*gm(-9) +phi9*gm(-10)+phi10*gm(-11)+phi11*gm(-12)+phi12*gm(-13) - theta1*dedb1(-1) - theta2*dedb1(-2); frml d17 dedb2 = -ip(-1)+phi1*ip(-2)+phi2*ip(-3)+phi3*ip(-4)+phi4*ip(-5) +phi5*ip(-6)+phi6*ip(-7)+phi7*ip(-8)+phi8*ip(-9) +phi9*ip(-10)+phi10*ip(-11)+phi11*ip(-12)+phi12*ip(-13) - theta1*dedb2(-1) - theta2*dedb2(-2); frml d18 dedb3 = -gip(-1)+phi1*gip(-2)+phi2*gip(-3)+phi3*gip(-4)+phi4*gip(-5) +phi5*gip(-6)+phi6*gip(-7)+phi7*gip(-8)+phi8*gip(-9) +phi9*gip(-10)+phi10*gip(-11)+phi11*gip(-12)+phi12*gip(-13) - theta1*dedb3(-1) - theta2*dedb3(-2); frml d19 dedb4 = -inf(-1)+phi1*inf(-2)+phi2*inf(-3)+phi3*inf(-4)+phi4*inf(-5) +phi5*inf(-6)+phi6*inf(-7)+phi7*inf(-8)+phi8*inf(-9) +phi9*inf(-10)+phi10*inf(-11)+phi11*inf(-12)+phi12*inf(-13) - theta1*dedb4(-1) - theta2*dedb4(-2); frml d20 dedb5 = -inf(-2)+phi1*inf(-3)+phi2*inf(-4)+phi3*inf(-5)+phi4*inf(-6) +phi5*inf(-7)+phi6*inf(-8)+phi7*inf(-9)+phi8*inf(-10) +phi9*inf(-11)+phi10*inf(-12)+phi11*inf(-13)+phi12*inf(-14) - theta1*dedb5(-1) - theta2*dedb5(-2); frml d21 dedb6 = -inf(-3)+phi1*inf(-4)+phi2*inf(-5)+phi3*inf(-6)+phi4*inf(-7) +phi5*inf(-8)+phi6*inf(-9)+phi7*inf(-10)+phi8*inf(-11) +phi9*inf(-12)+phi10*inf(-13)+phi11*inf(-14)+phi12*inf(-15) - theta1*dedb6(-1) - theta2*dedb6(-2); frml d22 dedb7 = -inf(-4)+phi1*inf(-5)+phi2*inf(-6)+phi3*inf(-7)+phi4*inf(-8) +phi5*inf(-9)+phi6*inf(-10)+phi7*inf(-11)+phi8*inf(-12) +phi9*inf(-13)+phi10*inf(-14)+phi11*inf(-15)+phi12*inf(-16) - theta1*dedb7(-1) - theta2*dedb7(-2); list deqs d1-d22; list dvars dedp1-dedp12 dedt1-dedt2 deda dedb1-dedb7; ? ? zero the presample values ? smpl 60:11 88:6; dot e dvars; . = 0; enddot; ? smpl 61:1 88:6; ? u exists from 60:1 ; use 12 lags copy @smpl esmpl; genr eqe; mat ssrold = e'e; print ssrold; ? mat novar = nrow(b); supres @logl @nob @coef @smpl; const maxit,50 maxsqz,30 tol,.001; do iter=1,maxit; dot deqs; genr(silent) .; enddot; ? Gauss-Newton iteration: regress e on derivatives ols(silent) e dvars; rename @coef delt; ? test for convergence and squeeze to determine stepsize. mat relchg = abs(delt)/(abs(b) + 10*tol); mat worst = max(relchg); if worst