OPTIONS CRT; NAME ILLUS44 'Sample Run for TSP 4.4: Illustrative Model from Manual' ; ? FREQ A; ? Annual frequency. SMPL 46 75 ; ? Sample is 1946 to 1975. LOAD ; ? Read in data. TREND TIME ; ? ? Data Transformations. ? P = P/100 ; LP = LOG(P) ; G = GOVEXP+EXPORTS ; R = RS ; PRINT GNP CONS I RS RL P ; SMPL 48,75 ; MNEW = (M+M(-1))/2 ; M = MNEW; DP = LOG(P/P(-1)) ; DP1 = DP(-1) ; SMPL 49,75 ; DM = LOG(M/M(-1)) ; PRINT G M DM TIME DP ; LGNPCUR = LOG(GNP*P) ; LM = LOG(M) ; LVELOC = LGNPCUR-LM ; LGNP = LOG(GNP) ; ? ? Data is now generated; Try estimation on single equations. ? SMPL 49,75 ; OPTIONS PLOTS ; TITLE 'OLSQ - Ordinary Least Squares' ; PAGE ; OLSQ CONS C,GNP ; ? ? Test the hypothesis that the marginal propensity to consume is one. ? FRML MPC GNP-1 ; ANALYZ MPC ; ? ? Form a consumption eq for model estimation later. ? FORM(COEFPREF=B) CONSEQ; TITLE 'PRINT Example from Users Guide' ; PAGE ; PRINT B1 CONSEQ @VCOV @RES; ? TITLE 'Engle-Granger Test for Cointegration' ; PAGE ; SMPL 50,75 ; DU = @RES-@RES(-1) ; OLSQ(SILENT) DU C TIME @RES(-1) ; ? Regress differenced residuals on SET TSTAT = @T(3); ? trend and lagged residual CDF(DICKEYF,TREND,DF=@NOB,PRINT) TSTAT ; ? Test with Dickey-Fuller dist. ? ? Plot the residuals from the consumption equation. ? SMPL 49,75 ; GENR CONSEQ CONSFIT ; RES = CONS-CONSFIT ; PLOT (MIN = -25,MAX = 25,VALUES,HEADER,BAND = STANDARD,INTEGER,BMEAN) RES * ; ? ? Estimation with correction for first order serial correlation. ? AR1 CONS C,GNP ; FORCST(PRINT) CONSP ; OPTIONS NOPLOT ; ? ? Two stage least squares. ? LIST IVS C G LM TIME ; ? Define a list of instrumental variables TITLE 'INST - Instrumental Variable Estimation' ; PAGE ; 2SLS(INST=IVS) CONS C,GNP; ? TITLE 'LIML - Limited Information Maximum Likelihood Estimation' ; PAGE ; LIML(INST=IVS) CONS C,GNP; PAGE; ? ? Linear Estimation of Investment Equation. ? CONST DELTA 15 ; GNPN = GNP/(DELTA+R) ; OLSQ I I(-1),GNPN ; FORCST(PRINT,DYNAM,DEPVAR = I) IFIT ; ? ? 'Nonlinear' Estimation of same equation by OLS and 2SLS. ? FRML INVEQ I = LAMBDA*I(-1) + ALPHA*GNP/(DELTA+R) ; PARAM LAMBDA .05 ALPHA .2 ; LSQ(PRINT) INVEQ ; LSQ(INST=IVS) INVEQ ; ? ? Linear Estimation of Interest Rate Equation. ? OLSQ R C,LVELOC ; 2SLS(INST=IVS) R C,LVELOC ; PARAM D F; UNMAKE @COEF D F; ? Starting values for INTRSTEQ below. ? ? Linear Estimation of Price Change Equation. ? OLSQ DP DP1 LGNP TIME C ; 2SLS(INST=IVS) DP DP1,LGNP,TIME,C ; PARAM PSI PHI TREND P0 ; ? Parameters of price level eqn. UNMAKE @COEF PSI PHI TREND P0 ; ? Set starting values for PRICEQ below. ? ? These are the equations of the simultaneous equations model. ? IDENT GNPID GNP-CONS-I-G ; ? The next equation was made by FORM earlier in the run. ? FRML CONSEQ CONS = B0 + B1*GNP ; FRML INTRSTEQ R = D + F*(LOG(GNP)+LP-LM) ; FRML PRICEQ LP = LP(-1) + PSI*(LP(-1)-LP(-2)) + PHI*LOG(GNP) + TREND*TIME +P0 ; ? ? Estimate by multivariate regression, assuming contemporaneous ? correlation of the residuals. ? LSQ(STEP = CEAB) CONSEQ INVEQ INTRSTEQ PRICEQ ; PRINT @FIT ; ? ? Estimate by nonlinear three stage least squares. ? TITLE '3SLS - Three Stage Least Squares' ; PAGE ; 3SLS(PRINT,INST=IVS) CONSEQ INVEQ INTRSTEQ PRICEQ ; ? ? Estimate by Full Information Maximum Likelihood. ? FIML(ENDOG=(GNP,CONS,I,R,LP)) GNPID CONSEQ INVEQ INTRSTEQ PRICEQ ; ? ? Test some nonlinear hypotheses about Long run coefficients. ? FRML LR1 ALPHALR = ALPHA/(1.-LAMBDA) ; FRML LR2 PHILR = PHI/(1.-PSI) ; PAGE; ANALYZ LR1 LR2 ; PAGE; ? ? Simulate the model over the second half of the sample ? and plot the results. ? SMPL 66 75 ; SIML (PRNSIM,PRNDAT,TAG = S,ENDOG = (GNP,CONS,I,R,LP)) CONSEQ INVEQ INTRSTEQ GNPID PRICEQ ; PLOT (RESTORE, MAX=1500, MIN=500, LINES=(1000)) GNP G GNPS H CONS C CONSS D ; PLOTS ; ACTFIT R RS ; END ; ? ? START OF THE DATA SECTION ? NOPRINT; SMPL 46 75 ; LOAD GNP CONS I ; ? GNP, CONSUMPTION, INVESTMENT 475.7 301.4 71 468.3 306.2 70.1 487.7 312.8 82.3 490.7 320.0 65.6 533.5 338.1 93.7 576.5 342.3 94.1 598.5 350.9 83.2 621.8 364.2 85.6 613.7 370.9 83.4 654.8 395.1 104.1 668.8 406.3 102.9 680.9 414.7 97.2 679.5 419.0 87.7 720.4 441.5 107.4 736.8 453.0 105.4 755.3 462.2 103.6 799.1 482.9 117.4 830.7 501.4 124.5 874.4 528.7 132.1 925.9 558.1 150.1 981.0 586.1 161.3 1007.7 603.2 152.7 1051.8 633.4 159.5 1078.8 655.4 168.0 1075.3 668.9 154.7 1107.5 691.9 166.8 1171.1 733.0 188.3 1233.4 766.3 207.4 1210.7 759.8 180.0 1186.4 766.6 138.9 ; LOAD EXPORTS ; ? EXPORTS 11.6 16.6 8.5 8.8 4.0 7.4 4.9 2 4.5 4.7 7.3 8.9 3.5 .9 5.5 6.7 5.8 7.3 10.9 8.2 4.3 3.5 -.4 -1.3 1.4 -.6 -3.3 7.2 16.6 23.5 ; LOAD GOVEXP ; ? GOVERNMENT EXPENDITURES 91.8 75.4 84.1 96.2 97.7 132.7 159.5 170.0 154.9 150.9 152.4 160.1 169.3 170.7 172.9 182.8 193.1 197.6 202.7 209.6 229.3 248.3 259.2 256.7 250.2 249.4 253.1 252.5 254.3 257.4 ; LOAD M ; ? MONEY SUPPLY 0 113.1 111.5 111.2 116.2 122.7 127.4 128.8 132.3 135.2 136.9 135.9 141.1 143.4 144.2 148.7 150.9 156.5 163.7 171.3 175.4 186.9 201.7 208.7 221.4 235.3 255.8 271.5 284.4 296.4 ; LOAD P ; ? PRICE LEVEL 44.06 49.7 53.13 52.59 53.64 57.27 58.00 58.88 59.69 60.98 62.9 65.02 66.06 67.52 68.67 69.28 70.55 71.59 72.71 74.32 76.76 79.02 82.57 86.72 91.36 96.02 100 105.92 116.20 126.35 ; LOAD RS ; ? SHORT TERM INTEREST RATE. .81 1.03 1.44 1.49 1.45 2.16 2.33 2.52 1.58 2.18 3.31 3.81 2.46 3.97 3.85 2.97 3.26 3.55 3.97 4.38 5.55 5.10 5.90 7.83 7.72 5.11 4.69 8.15 9.87 6.33 ; LOAD RL ; ? LONG TERM INTEREST RATE. 2.53 2.61 2.82 2.66 2.62 2.86 2.96 3.2 2.9 3.06 3.36 3.89 3.79 4.38 4.41 4.35 4.33 4.26 4.4 4.49 5.13 5.51 6.18 7.03 8.04 7.39 7.21 7.44 8.57 8.83 ; END ;