* * Example 19.3 from pp 570-571 * open data tablef2-2[1].txt calendar 1960 data(format=prn,org=columns) 1960:1 1995:1 year g pg y pnc puc ppt pd pn ps pop * set loggpop = log(100*g/pop) set logypop = log(y) set logpg = log(pg) set logpnc = log(pnc) set logpuc = log(puc) set logppt = log(ppt) set trend = t * * Unrestricted distributed lag * linreg loggpop / residsols # constant logpnc logpuc logppt trend logpg{0 to 5} logypop{0 to 5} * * Estimate the long run elasticities. Keep the estimates to build a table at the * end. * summarize(title="Long Run Price Elasticity-Unrestricted") # logpg{0 to 5} compute olsLRP=%sumlc,olsSRP=%beta(6) summarize(title="Long Run Income Elasticity-Unrestricted") # logypop{0 to 5} compute olsLRI=%sumlc,olsSRI=%beta(12) * * This estimates the expectations model through the use of recursively generated * formulas. The "z" variables are generated from series x by the recursion. * * z(x) = lambda * old z(x) + x * * The one tricky part of this is that the initial value for the z depends upon * the parameter lambda. In order to see that the recursion is properly * initialized for each set of parameters, a "startup" FRML is created. This is * evaluated once per function evaluation, with the variable t equal to the first * entry of the estimation range. This sets the initial values for the two z * variables (which are called pgz for price and yz for income). * * Note that this will come up with slightly different results than are shown in * the text, because it's estimating the lambda directly rather than using a grid * search. If you fix lambda at .66 (which you can do by changing the NONLIN * to have lambda=.66 instead of just lambda), you'll get the same estimates as * shown. * nonlin b0 b1 b2 b3 b4 bpg by lambda compute b0=%beta(1),b1=%beta(2),b3=%beta(3),b4=%beta(4),bpg=%beta(5),by=%beta(11),lambda=.3 frml init = pgz=logpg(t)/(1-lambda),yz=logypop(t)/(1-lambda) frml zpgf = pgz=lambda*pgz+logpg frml zyf = yz=lambda*yz+logypop frml expmodel loggpop = b0+b1*logpnc+b2*logpuc+b3*logppt+b4*trend+bpg*zpgf+by*zyf nlls(startup=init,frml=expmodel) loggpop / residsexp summarize(title="Long Run Price Elasticity-Geometric") bpg/(1-lambda) compute geoLRP=%sumlc,geoSRP=bpg summarize(title="Long Run Income Elasticity-Geometric") by/(1-lambda) compute geoLRI=%sumlc,geoSRI=by * * Partial adjustment model * linreg loggpop / residspar # constant logpnc logpuc logppt trend logpg logypop loggpop{1} summarize(title="Long Run Price Elasticity-Partial Adjustment") %beta(6)/(1-%beta(8)) compute parLRP=%sumlc,parSRP=%beta(6) summarize(title="Long Run Income Elasticity-Partial Adjustment") %beta(7)/(1-%beta(8)) compute parLRI=%sumlc,parSRI=%beta(7) * * Generate Table 19.2 * report(action=define) report(atrow=1,atcol=2,span) "Short Run" report(atrow=1,atcol=4,span) "Long Run" report(atrow=2,atcol=2) "Price" "Income" "Price" "Income" report(atrow=3,atcol=1) "Unrestricted Model" olsSRP olsSRI olsLRP olsLRI report(atrow=4,atcol=1) "Expectations Model" geoSRP geoSRI geoLRP geoLRI report(atrow=5,atcol=1) "Partial Adjustment Model" parSRP parSRI parLRP parLRI report(action=format,picture="*.###") report(action=show,window="Table 19.2 Estimated Elasticities") * sstats 6 36 residsols**2>>olssqr residsexp**2>>expsqr residspar**2>>parsqr * cdf(title="Approximate F-Test for Expectations Model") ftest (expsqr-olssqr)/9/(olssqr/14) 9 14 cdf(title="Approximate F-Test for Partial Adjustment Model") ftest (parsqr-olssqr)/9/(olssqr/14) 9 14