$ontext Two-stage least squares (2SLS) of Klein's Model I References: Theil, H. (1971) Principles of Econometrics, Wiley Greene, W. H. (2000) Econometric Analysis, 4th edn, Prentice Hall, New York. Klein, L.R. (1950) Economic Fluctuations in the United States 1921-1941, Wiley SAS results for first equation (Consumption function): OLS estimation: ============== /*OLS Estimate*/ proc reg data=klein; model C = P Plag W; run; quit; The REG Procedure Model: MODEL1 Dependent Variable: C Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 923.55008 307.85003 292.71 <.0001 Error 17 17.87945 1.05173 Corrected Total 20 941.42952 Root MSE 1.02554 R-Square 0.9810 Dependent Mean 53.99524 Adj R-Sq 0.9777 Coeff Var 1.89932 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 16.23660 1.30270 12.46 <.0001 P 1 0.19293 0.09121 2.12 0.0495 Plag 1 0.08988 0.09065 0.99 0.3353 W 1 0.79622 0.03994 19.93 <.0001 2SLS procedure on the same equation: =================================== /* 2sls Estimate*/ proc model data=klein; C = cons_c + P_c * P + Plag_c * Plag + W_c*W; ENDOGENOUS W P X; EXOGENOUS T Wg G; fit C /n2sls vardef=N; instruments G T A Wg Plag Klag Xlag ; run; quit; The MODEL Procedure Nonlinear 2SLS Summary of Residual Errors DF DF Adj Equation Model Error SSE MSE Root MSE R-Square R-Sq C 4 17 21.9252 1.0441 1.0218 0.9767 0.9726 Nonlinear 2SLS Parameter Estimates Approx Approx Parameter Estimate Std Err t Value Pr > |t| cons_c 16.55476 1.3208 12.53 <.0001 P_c 0.017302 0.1180 0.15 0.8852 Plag_c 0.216234 0.1073 2.02 0.0599 W_c 0.810183 0.0402 20.13 <.0001 Number of Observations Statistics for System Used 21 Objective 0.4361 Missing 1 Objective*N 9.1580 $offtext set t /1920*1941/; * keys: * c = CONSUMPTION * p = PROFITS * wp = PRIVATE WAGE BILL * i = INVESTMENT * x = PRIVATE PRODUCTION * wg = GOVT WAGE BILL * g = GOVT DEMAND * t = TAXES * k = CAPITAL STOCK * wsum = TOTAL WAGE BILL * set p /c, p, wp, i, x, wg, g, t, k, wsum/; table data(t,p) c p wp i x wg g t k wsum 1920 12.7 44.9 182.8 1921 41.9 12.4 25.5 -0.2 45.6 2.7 3.9 7.7 182.6 28.2 1922 45.0 16.9 29.3 1.9 50.1 2.9 3.2 3.9 184.5 32.2 1923 49.2 18.4 34.1 5.2 57.2 2.9 2.8 4.7 189.7 37.0 1924 50.6 19.4 33.9 3.0 57.1 3.1 3.5 3.8 192.7 37.0 1925 52.6 20.1 35.4 5.1 61.0 3.2 3.3 5.5 197.8 38.6 1926 55.1 19.6 37.4 5.6 64.0 3.3 3.3 7.0 203.4 40.7 1927 56.2 19.8 37.9 4.2 64.4 3.6 4.0 6.7 207.6 41.5 1928 57.3 21.1 39.2 3.0 64.5 3.7 4.2 4.2 210.6 42.9 1929 57.8 21.7 41.3 5.1 67.0 4.0 4.1 4.0 215.7 45.3 1930 55.0 15.6 37.9 1.0 61.2 4.2 5.2 7.7 216.7 42.1 1931 50.9 11.4 34.5 -3.4 53.4 4.8 5.9 7.5 213.3 39.3 1932 45.6 7.0 29.0 -6.2 44.3 5.3 4.9 8.3 207.1 34.3 1933 46.5 11.2 28.5 -5.1 45.1 5.6 3.7 5.4 202.0 34.1 1934 48.7 12.3 30.6 -3.0 49.7 6.0 4.0 6.8 199.0 36.6 1935 51.3 14.0 33.2 -1.3 54.4 6.1 4.4 7.2 197.7 39.3 1936 57.7 17.6 36.8 2.1 62.7 7.4 2.9 8.3 199.8 44.2 1937 58.7 17.3 41.0 2.0 65.0 6.7 4.3 6.7 201.8 47.7 1938 57.5 15.3 38.2 -1.9 60.9 7.7 5.3 7.4 199.9 45.9 1939 61.6 19.0 41.6 1.3 69.5 7.8 6.6 8.9 201.2 49.4 1940 65.0 21.1 45.0 3.3 75.7 8.0 7.4 9.6 204.5 53.0 1941 69.7 23.5 53.3 4.9 88.4 8.5 13.8 11.6 209.4 61.8 ; display data; set t1(t) 'from 1921'; t1(t)$(ord(t)>1) = yes; * * calculate A(t) * parameter A(t) 'year, 1931=zero'; scalar ord31; ord31 = sum(sameas(t,'1931'),ord(t)); A(t) = ord(t)-ord31; display A; * * calculate lagged variables * parameter klag(t),plag(t),xlag(t); klag(t) = data(t-1,'k'); plag(t) = data(t-1,'p'); xlag(t) = data(t-1,'x'); display klag,plag,xlag; *-------------------------------------------------------------------------------------------- * OSL estimation of individual equations *-------------------------------------------------------------------------------------------- variables sse a0,a1,a2,a3 b0,b1,b2,b3 g0,g1,g2,g3 ; equations sumsq 'dummy objective' cons(t) 'consumption function' inv(t) 'investment function' labor(t) 'labor equation' ; sumsq.. sse =e= 0; cons(t1(t)).. data(t,'c') =e= a0 + a1*data(t,'p') + a2*plag(t) + a3*data(t,'wsum'); inv(t1(t)).. data(t,'i') =e= b0 + b1*data(t,'p') + b2*plag(t) + b3*klag(t); labor(t1(t)).. data(t,'wsum') =e= g0 + g1*data(t,'x') + g2*xlag(t) + g3*A(t); option lp=ls; model cons_ols /sumsq,cons/; model inv_ols /sumsq,inv/; model lab_ols /sumsq,labor/; solve cons_ols minimizing sse using lp; solve inv_ols minimizing sse using lp; solve lab_ols minimizing sse using lp; *-------------------------------------------------------------------------------------------- * 2SLS estimation of individual equations * * STAGE 1: Endogenous variables against all exogenous variables. Save fitted values. *-------------------------------------------------------------------------------------------- variables p0,p1,p2,p3,p4,p5,p6,p7 w0,w1,w2,w3,w4,w5,w6,w7 x0,x1,x2,x3,x4,x5,x6,x7 ; equations Pfit(t) Wfit(t) Xfit(t) ; parameters Pfitted(t) Wfitted(t) Xfitted(t) ; pfit(t1(t)).. data(t,'p') =e= p0 + p1*data(t,'g') + p2*data(t,'t') + p3*A(t) + p4*data(t,'Wg') + p5*plag(t) + p6*klag(t) + p7*xlag(t); wfit(t1(t)).. data(t,'wsum') =e= w0 + w1*data(t,'g') + w2*data(t,'t') + w3*A(t) + w4*data(t,'Wg') + w5*plag(t) + w6*klag(t) + w7*xlag(t); xfit(t1(t)).. data(t,'x') =e= x0 + x1*data(t,'g') + x2*data(t,'t') + x3*A(t) + x4*data(t,'Wg') + x5*plag(t) + x6*klag(t) + x7*xlag(t); model stage1_p /sumsq,pfit/; model stage1_w /sumsq,wfit/; model stage1_x /sumsq,xfit/; solve stage1_p minimizing sse using lp; execute_load 'ls.gdx',Pfitted=fitted; display Pfitted; solve stage1_w minimizing sse using lp; execute_load 'ls.gdx',Wfitted=fitted; display Wfitted; solve stage1_x minimizing sse using lp; execute_load 'ls.gdx',Xfitted=fitted; display Xfitted; *-------------------------------------------------------------------------------------------- * STAGE 2 *-------------------------------------------------------------------------------------------- variables aa0,aa1,aa2,aa3 bb0,bb1,bb2,bb3 gg0,gg1,gg2,gg3 ; equations cons2(t) inv2(t) labor2(t) ; cons2(t1(t)).. data(t,'c') =e= aa0 + aa1*pfitted(t) + aa2*plag(t) + aa3*wfitted(t); inv2(t1(t)).. data(t,'i') =e= bb0 + bb1*pfitted(t) + bb2*plag(t) + bb3*klag(t); labor2(t1(t)).. data(t,'wsum') =e= gg0 + gg1*xfitted(t) + gg2*xlag(t) + gg3*A(t); model stage2_cons /sumsq, cons2/; model stage2_inv /sumsq, inv2/; model stage2_lab /sumsq, labor2/; solve stage2_cons minimizing sse using lp; solve stage2_inv minimizing sse using lp; solve stage2_lab minimizing sse using lp; *-------------------------------------------------------------------------------------------- * display results *-------------------------------------------------------------------------------------------- display "----- OLS RESULTS ------------------------------------------------------------------", a0.l,a1.l,a2.l,a3.l, b0.l,b1.l,b2.l,b3.l, g0.l,g1.l,g2.l,g3.l, "----- 2SLS RESULTS -----------------------------------------------------------------", aa0.l,aa1.l,aa2.l,aa3.l, bb0.l,bb1.l,bb2.l,bb3.l, gg0.l,gg1.l,gg2.l,gg3.l;