* * Estimates of Klein's Model I from page 412 * open data tablef15-1[1].txt calendar 1920 data(format=prn,org=columns) 1920:1 1941:1 year c p wp in k1 x wg g tax set totwage = wp+wg set trend = (t-1931:1) * * OLS * linreg(define=conseq) c # constant p{0 1} totwage linreg(define=inveq) in # constant p{0 1} k1 linreg(define=wageeq) wp # constant x x{1} trend * * 2SLS * Std errors differ by sqrt(%ndf/%nobs). You can get the same standard errors as * shown in the text by adding the options ROBUSTERRORS and NOZUDEP. * instruments constant trend wg g tax p{1} x{1} k1 linreg(inst,equation=conseq) linreg(inst,equation=inveq) linreg(inst,equation=wageeq) * * GMM - single equation * The results in the text can be obtained using the options OPTIMAL with ITERS=3. * Ordinarily, LINREG with OPTIMAL will do a two-step process - estimating first by * 2SLS, computing the weight matrix using the instruments and the 2SLS residuals, * then recomputing the estimates based upon that weight matrix. Because this * produces new estimates, it also produces new residuals, which can be used to * compute a new weighting matrix. The results in the text were done by repeating * this one additional time, hence ITERS=3. * linreg(inst,equation=conseq,optimal,iters=3) linreg(inst,equation=inveq,optimal,iters=3) linreg(inst,equation=wageeq,optimal,iters=3) * * LIML * @liml c # constant p{0 1} totwage @liml in # constant p{0 1} k1 @liml wp # constant x x{1} trend * * 3SLS * sur(inst) 3 # conseq # inveq # wageeq * * Iterated 3SLS * sur(inst,iters=100) 3 # conseq # inveq # wageeq * * GMM - systems * You can't estimate all three equations simultaneously because computing the * weight matrix requires the covariance matrix of all combinations of the eight * instruments with the three residuals. Since there are only 21 observations, you * can't freely estimate a 24x24 covariance matrix. Restricting it to two * equations limits the size of the weight matrix to 16x16. This is doable, though * the weight matrix may still be close to singular. The estimates in the text for * the C and I equations comes from a joint estimate of those two equations, while * the W equation comes from a joint estimate of C and W. * sur(inst,zudep) 2 # conseq # inveq sur(inst,zudep) 2 # conseq # wageeq * * Because the equations are linear in the variables and parameters, SUR is the * simplest way to estimate them. With non-linearities or restrictions across * equations, you would need to use the non-linear systems estimation instruction * NLSYSTEM. This shows how to do the same model using the non-linear instructions. * * This creates a (nonlinear) FRML from the linear equations. The free coefficients * are named "b1", "b2", "b3" and "b4" in the consumption equation, similarly with * "i"s and "w"'s for the other two * frml(equation=conseq,names="b") consfrml frml(equation=inveq,names="i") invfrml frml(equation=wageeq,names="w") wagefrml * * This creates the parameter set to estimate * nonlin b1 b2 b3 b4 i1 i2 i3 i4 w1 w2 w3 w4 * * Non-iterated 3SLS via NLSYSTEM. This has to be done with two separate * instructions (controlling the covariance matrix) as the standard behavior for * NLSYSTEM is to iterate on both the coefficients and the covariance matrix. (SUR * doesn't have to worry about iterating on the coefficients, since the optimum * given the covariance matrix can just be calculated directly). * nlsystem(inst,cv=%identity(3)) / consfrml invfrml wagefrml nlsystem(inst,cv=%sigma) / consfrml invfrml wagefrml * * I3SLS via NLSYSTEM * nlsystem(inst) / consfrml invfrml wagefrml * * GMM with NLSYSTEM. Again, we can only estimate two at a time. We have to alter * the parameter sets to match the formulas being estimated. * nonlin b1 b2 b3 b4 i1 i2 i3 i4 nlsystem(inst,zudep,trace) / consfrml invfrml nonlin b1 b2 b3 b4 w1 w2 w2 w4 nlsystem(inst,zudep,trace) / consfrml wagefrml * * FIML * dec frml[rect] gamma frml gamma = || 1.0, 0.0, 0.0, -1.0, 0.0, 0.0|$ 0.0, 1.0, 0.0, -1.0, 0.0, -1.0|$ -b4, 0.0, 1.0, 0.0, 1.0, 0.0|$ 0.0, 0.0, -w2, 1.0, -1.0, 0.0|$ -b2, -i2, 0.0, 0.0, 1.0, 0.0|$ 0.0, 0.0, 0.0, 0.0, 0.0, 1.0|| * frml jacobian = %det(gamma) nonlin b1 b2 b3 b4 i1 i2 i3 i4 w1 w2 w3 w4 nlsystem(jacobian=jacobian,iters=400) / consfrml invfrml wagefrml