* * Nerlove Exercise * Pages 76-81, based upon discussion on pages 60-69 * * Read data file * open data nerlove.xls data(format=xls,org=columns) 1 145 tc q pl pf pk * * Generate needed variables * set ltc = log(tc) set lq = log(q) set lpl = log(pl) set lpk = log(pk) set lpf = log(pf) set ltcf = ltc-lpf set lplf = lpl-lpf set lpkf = lpk-lpf * * (b) Unrestricted model, including an plot of residuals against lq * linreg ltc / resids # constant lq lpl lpk lpf scatter(footer="Figure 1.7: Plot of Residuals against Log Output") # lq resids * * (c) Restricted model * linreg ltcf # constant lq lplf lpkf compute rss0=%rss,ndf0=%ndf * * (d) Model 1. Coefficients and variances allowed to differ * linreg ltcf 1 29;# constant lq lplf lpkf linreg ltcf 30 58;# constant lq lplf lpkf linreg ltcf 59 87;# constant lq lplf lpkf linreg ltcf 88 116;# constant lq lplf lpkf linreg ltcf 117 145;# constant lq lplf lpkf * * (e) Model 2. Coefficients allowed to differ * set d1 = t<=29 set d2 = t>29 .and. t<=58 set d3 = t>58 .and. t<=87 set d4 = t>87 .and. t<=116 set d5 = t>116 .and. t<=145 set lq1 = d1*lq set lq2 = d2*lq set lq3 = d3*lq set lq4 = d4*lq set lq5 = d5*lq set lplf1 = d1*lplf set lplf2 = d2*lplf set lplf3 = d3*lplf set lplf4 = d4*lplf set lplf5 = d5*lplf set lpkf1 = d1*lpkf set lpkf2 = d2*lpkf set lpkf3 = d3*lpkf set lpkf4 = d4*lpkf set lpkf5 = d5*lpkf linreg ltcf # d1 d2 d3 d4 d5 lq1 lq2 lq3 lq4 lq5 $ lplf1 lplf2 lplf3 lplf4 lplf5 lpkf1 lpkf2 lpkf3 lpkf4 lpkf5 compute rss2=%rss,ndf2=%ndf * * (f) Chow test * Unrestricted model = Model (2), Restricted model = (2.4.6) * Calculate F ratio in two ways. * * Method 1: rewrite the regression so that the linear restrictions become * exclusion restrictions * linreg ltcf # constant lq lplf lpkf $ d2 d3 d4 d5 lq2 lq3 lq4 lq5 lplf2 lplf3 lplf4 lplf5 lpkf2 lpkf3 lpkf4 lpkf5 exclude # d2 d3 d4 d5 lq2 lq3 lq4 lq5 lplf2 lplf3 lplf4 lplf5 lpkf2 lpkf3 lpkf4 lpkf5 * * Method 2: Use two SSR's * compute rssu=rss2, rssr=rss0,ndfu=ndf2,ndfr=ndf0 compute fstat = ((rssr-rssu)/(ndfr-ndfu))/(rssu/ndfu) cdf(title="Chow Test") ftest fstat ndfr-ndfu ndfu * * (g) Test neutral variations in scale * * Unrestricted model = Model 2, Restricted model = Model 3 * linreg ltcf # d1 d2 d3 d4 d5 lq1 lq2 lq3 lq4 lq5 lplf lpkf compute rss3=%rss,ndf3=%ndf compute rssu=rss2, rssr=rss3,ndfu=ndf2,ndfr=ndf3 compute fstat = ((rssr-rssu)/(ndfr-ndfu))/(rssu/ndfu) cdf(title="Test for Neutral Variations in Scale") ftest fstat ndfr-ndfu ndfu * * (h) Weighted regression, Model 4 * * First, this is done literally by weighted least squares * set w = sqrt(0.0565+2.1377/q) set ltcfw = ltcf/w set cw = 1/w set lqw = lq/w set lqsqw = (lq**2)/w set lplfw = lplf/w set lpkfw = lpkf/w linreg ltcfw # cw lqw lqsqw lplfw lpkfw * * Now, by using the SPREAD option on LINREG * set sw = (0.0565+2.1377/q) set lqsq = lq**2 linreg(spread=sw) ltcf # constant lq lqsq lplf lpkf