* * NLLS.RPF * RATS Version 8, User's Guide, Example 4.1 * Taken from Examples 10.1 and 10.3 of Pindyck and Rubinfeld, 4th * edition. * calendar(q) 1947:1 open data nllsmpc.xls data(format=xls,org=obs) 1947:1 1995:3 * * For convenience, rename the dataset variables to match the P&R names. * set c = gcq set yd = gydq * * Estimate the non-linear model using NLLS * nonlin a0 a1 a2 frml consfrml c = a0 + a1*yd^a2 compute a0=a1=a2=1.0 nlls(frml=consfrml) c compute rssunr=%rss * * Compute the MPC for several values of YD. The value listed in P&R for * the MPC at 600 and the conclusion about the behavior of MPC as YD * increases are both incorrect. * disp "MPC at" ####.# %avg(yd) "=" #.### a1*a2*%avg(yd)^(a2-1.0) disp "MPC at" ####.# 600.0 "=" #.### a1*a2*600**(a2-1.0) * * Do a Wald test of a2=1. a2 is coefficient #3 * test # 3 # 1.0 * * Impose the restriction that a2 is 1. * nonlin a0 a1 a2=1.0 nlls(frml=consfrml) c / resids * * Do a likelihood ratio test * cdf chisqr %nobs*(log(%rss)-log(rssunr)) 1 * * Do an LM test. Here this will be a test of the significance of a * regression of the residuals on the derivatives of the residuals with * respect to three parameters,evaluated at the restricted estimates. The * derivatives with respect to a0 and a1 are just constant and yd, so we * only have to create a new series for the derivative with respect to * a2. Note that the value of 194.6 given for this on p 285 of P&R is * incorrect. That value came off the wrong regression. * set a2deriv = a1*yd*log(yd) * linreg resids # constant yd a2deriv * cdf chisqr %trsq 1