* * Martin, Hurn, Harris, "Econometric Modelling with Time Series" * Application 5.5.2 from pp 184-187 * The Klein Model of the U.S. Economy * open data klein.dat calendar(a) 1920:1 data(format=prn,nolabels,org=columns) 1920:01 1941:01 c p pw in klag d income gw g tax * set trend = (t-1931:1) set tw = pw+gw * nonlin a0 a1 a2 a3 b0 b1 b2 b3 g0 g1 g2 g3 * frml consfrml c = a0+a1*p+a2*p{1}+a3*tw frml invfrml in = b0+b1*p+b2*p{1}+b3*klag frml wagefrml pw = g0+g1*d+g2*d{1}+g3*trend * * OLS * linreg(define=conseq) c # constant p{0 1} tw linreg(define=inveq) in # constant p{0 1} klag linreg(define=wageeq) pw # constant d d{1} trend * * IV (2SLS), saving the estimated coefficients for use in the FIML * estimates. * instruments constant trend gw g tax p{1} d{1} klag linreg(equation=conseq,inst) compute a0=%beta(1),a1=%beta(2),a2=%beta(3),a3=%beta(4) linreg(equation=inveq,inst) compute b0=%beta(1),b1=%beta(2),b2=%beta(3),b3=%beta(4) linreg(equation=wageeq,inst) compute g0=%beta(1),g1=%beta(2),g2=%beta(3),g3=%beta(4) * * FIML * dec frml[rect] gamma frml gamma = || 1.0, 0.0, -a3, 0.0, -a1, 0.0|\$ 0.0, 1.0, 0.0, 0.0, -b1, 0.0|\$ 0.0, 0.0, 1.0, -g1, 0.0, 0.0|\$ -1.0, -1.0, 0.0, 1.0, 0.0, 0.0|\$ 0.0, 0.0, 1.0, -1.0, 1.0, 0.0|\$ 0.0, -1.0, 0.0, 0.0, 0.0, 1.0|| * frml jacobian = %det(gamma) nlsystem(jacobian=jacobian,iters=1000) / consfrml invfrml wagefrml