* * SIMULEST.RPF * RATS Version 8, User's Guide, Example 8.1. * open data prsmall.xls cal(q) 1947 data(format=xls,org=obs) 1947:1 1988:1 * set ydiff = gnp-gnp{1} set rsum = rate+rate{1} set mdiff = m-m{1} * instruments constant cons{1} ydiff{1} gnp{1} govt mdiff rsum{1} rate{4} * * First, we estimate the equations by 2SLS. * linreg(inst) cons 1950:1 1985:4 residc # constant gnp cons{1} linreg(inst) invest 1950:1 1985:4 residi # constant ydiff{1} gnp rate{4} linreg(inst) rate 1950:1 1985:4 residr # constant gnp ydiff mdiff rsum{1} * * Pindyck and Rubinfeld note the low Durbin-Watson on the investment * equation. This is re-estimated using AR1. The Hildreth-Lu procedure * gives a very different result from Cochrane-Orcutt (actually Fair's * procedure), with a rho effectively of 1.0. We therefore replace P&R's * investment equation with one redone to provide better dynamic behavior. * instruments constant cons{1 2} ydiff{1 2} gnp{1} govt{0 1} mdiff{0 1} rate{1 to 5} ar1(method=hilu,inst) invest 1950:1 1985:4 # constant ydiff{1} gnp rate{4} ar1(method=corc,inst) invest 1950:1 1985:4 # constant ydiff{1} gnp rate{4} * * The investment equation is altered by adding lagged investment to the * explanatory variables. The complete model is then re-estimated with an * updated set of instruments * instruments constant cons{1} ydiff{1} gnp{1} invest{1} $ govt mdiff rsum{1} rate{4} linreg(inst,frml=conseq) cons 1950:1 1985:4 residc # constant gnp cons{1} linreg(inst,frml=investeq) invest 1950:1 1985:4 residi # constant invest{1} ydiff{1} gnp rate{4} linreg(inst,frml=rateeq) rate 1950:1 1985:4 residr # constant gnp ydiff mdiff rsum{1} * * LIML estimation uses the LIML procedure * @liml cons 1950:1 1985:4 # constant gnp cons{1} @liml invest 1950:1 1985:4 # constant invest{1} ydiff{1} gnp rate{4} @liml rate 1950:1 1985:4 # constant gnp ydiff mdiff rsum{1} * * We now estimate the model using 3SLS with the instruction SUR. * equation consleq cons # constant gnp cons{1} equation investleq invest # constant invest{1} ydiff{1} gnp rate{4} equation rateleq rate # constant gnp ydiff mdiff rsum{1} * sur(inst,iterations=10) 3 1950:1 1985:4 # consleq residc # investleq residi # rateleq residr * * We next estimate the model using 3SLS with the instruction NLSYSTEM. * (Not necessary here but would be if there were some non-linearities). * nonlin(parmset=structural) c0 c1 c2 i0 i1 i2 i3 i4 r0 r1 r2 r3 r4 frml consnl cons = c0+c1*gnp+c2*cons{1} frml investnl invest = i0+i1*invest{1}+i2*ydiff{1}+i3*gnp+i4*rate{4} frml ratenl rate = r0+r1*gnp+r2*ydiff+r3*mdiff+r4*rsum{1} nlsystem(inst,parmset=structural,cvout=v) 1950:1 1985:4 consnl investnl ratenl * * Finally, we estimate the model by FIML. This adds to the standard * likelihood for a multivariate Normal model, the log det of the * Jacobian of the transformation from residuals to endogenous variables. * This is done using the Jacobian option, which gives the determinant. * In this case, this actually would reduce to 1-c1-i3, but we write out * the full expression. * frml jacobian = %det(||1.0,0.0,0.0,-c1|0.0,1.0,0.0,-i3|0.0,0.0,1.0,0.0|-1.0,-1.0,0.0,1.0||) nlsystem(parmset=structural,cvout=v,jacobian=jacobian,title="FIML Estimates") $ 1950:1 1985:4 consnl investnl ratenl