* Chapter 15.4 - The Seemingly Unrelated Regression Model. * W.H. Greene, Econometric Analysis, Fourth Edition, 2000. SAMPLE 1 20 READ (grunfeld.shd) YEAR FIRM I1 F1 C1 / NOREWIND SKIPLINE=1 READ (grunfeld.shd) YEAR FIRM I2 F2 C2 / NOREWIND READ (grunfeld.shd) YEAR FIRM I3 F3 C3 / NOREWIND READ (grunfeld.shd) YEAR FIRM I4 F4 C4 / NOREWIND READ (grunfeld.shd) YEAR FIRM I5 F5 C5 / NOREWIND * Example 15.15 - Autocorrelation in the SUR Model * Estimate each equation by OLS (the ITER=0 option on the SYSTEM * command gives OLS estimation). * The RSTAT option reports Durbin-Watson test statistics as listed * in Table 15.9, p. 635. * The COEF= option is used to save the coefficients for use as * starting values for the NL command. GENR CONST=1 SYSTEM 5 / DN NOCONSTANT COEF=BETA RSTAT ITER=0 OLS I1 F1 C1 CONST OLS I2 F2 C2 CONST OLS I3 F3 C3 CONST OLS I4 F4 C4 CONST OLS I5 F5 C5 CONST END * The DRHO option on the NL command assumes an autocorrelation * process as stated in Chapter 15.4.6, p. 634. * The NL command iterates to convergence. * The Greene textbook recommends a 3-step method at the top of * page 635. Greene notes that there is no benefit to iteration. NL 5 / NCOEF=15 START=BETA DRHO COEF=BEST STDERR=SE SIGMA=SIGMA EQ I1 = B11*F1+B12*C1+B10 EQ I2 = B21*F2+B22*C2+B20 EQ I3 = B31*F3+B32*C3+B30 EQ I4 = B41*F4+B42*C4+B40 EQ I5 = B51*F5+B52*C5+B50 END * Print the results - compare with Table 15.9, p. 635 COPY BEST B / FROW=1;15 TROW=1;15 COPY BEST RHO / FROW=16;20 TROW=1;5 COPY SE STDE / FROW=1;15 TROW=1;15 MATRIX B=VEC(B,3) MATRIX STDE=VEC(STDE,3) * Estimated covariance matrix for the epsilon errors. DIM V 5 5 SET NODOECHO DO #=1,5 GEN1 II=# DO %=1,II MATRIX V(#,%)=SIGMA(#,%)/(1-(RHO:#)*(RHO:%)) MATRIX V(%,#)=V(#,%) ENDO ENDO SAMPLE 1 3 FORMAT(3A4) READ LABELS / BYVAR FORMAT B2 B3 B1 MATRIX B=(LABELS|B|STDE) SAMPLE 1 5 FORMAT(5F12.3) * Autocorrelation coefficients PRINT RHO / FORMAT * The residual covariance matrix PRINT V / FORMAT * The parameter estimates FORMAT(A4,5F12.3/5X,5(3X,'(',F7.3,')')/) PRINT B / FORMAT * Vector autoregression - this section is provided to demonstrate * more features of SHAZAM. SAMPLE 1 20 * Set starting values using the previous estimation. DIM BEST1 40 COPY BEST BEST1 / FROW=1;15 TROW=1;15 MATRIX RHOV=VEC(DIAG(RHO)) COPY RHOV BEST1 / FROW=1;25 TROW=16;40 NL 5 / NCOEF=15 START=BEST1 ACROSS COEF=BEST2 ITER=500 PITER=100 EQ I1 = B11*F1+B12*C1+B10 EQ I2 = B21*F2+B22*C2+B20 EQ I3 = B31*F3+B32*C3+B30 EQ I4 = B41*F4+B42*C4+B40 EQ I5 = B51*F5+B52*C5+B50 END * Print the matrix of autocorrelation coefficients COPY BEST2 RHOV / FROW=16;40 TROW=1;25 MATRIX RHO1=VEC(RHOV,5) FORMAT(5F12.3) PRINT RHO1 / FORMAT * Test for stability -- see page 744. * The characteristic roots must have modulus less than one * (the roots can be complex). MATRIX ROOT=EIGVAL(RHO1) PRINT ROOT MATRIX R1=ROOT(0,1) MATRIX R2=ROOT(0,2) SAMPLE 1 5 GENR MOD=SQRT(R1**2+R2**2) PRINT R1 R2 MOD STOP