* * Chapter 10 empirical exercise * pp 665-667 * calendar 1900 * * Read data file * open data mpyrx.xls data(org=columns,format=xls) 1900:1 1989:1 m p y r * column 1: log M1 * column 2: log price * column 3: log income * column 4: interest rate * * Generate real money supply, velocity and trend * set rm = m-p set rv = y-rm * set trend = t * graph(footer="Figure 10.2 US Real NNP and Real M1, in Logs",$ key=below,klabels=||"Real M1","Net National Product"||) 2 # rm # y graph(footer="Figure 10.3 Log M1 Velocity and Short-Term Commercial Paper Rate",$ overlay=line,vlabel="M1 Velocity",ovlabel="Commercial Paper Rate",key=below,$ klabels=||"M1 Velocity","Com Paper Rate"||) 2 # rv # r * * (a) ADF on real money, r, and log NNP, 1900-1989. * * Real money supply. * @dfunit(ttest,trend,lags=2) rm @dfunit(ttest,trend,lags=4) rm * * Interest rate * @dfunit(ttest,lags=2) r @dfunit(ttest,lags=4) r * * Real NNP * @dfunit(ttest,trend,lags=2) y @dfunit(ttest,trend,lags=4) y * * (b) Residual-based test for cointegration: real money on y and r. * linreg rm / resid # constant y r * * @EGTestResids has the same mechanics as a Dickey-Fuller test (applied to the * residuals from this last regression), but uses a different lookup table for the * critical values * @egtestresids(nvar=3,lags=1) resid * * (c) SOLS and DOLS * * SOLS 1903-1987 * linreg rm 1903:1 1987:1 # constant y r * * DOLS - Note that there is a procedure (SWDOLS) for doing the dynamic OLS * estimation. This shows the process that that procedure follows. * set dy = y-y{1} set dr = r-r{1} linreg rm 1903:1 1987:1 resid # constant y r dy{-2 to 2} dr{-2 to 2} * * This uses the DFC (degrees of freedom correction) option to get the proper * divisor on the standard error calculation. * linreg(dfc=%nreg) resid # resid{1 to 2} compute lambdasq=%seesq/(1-%sum(%beta))**2 * * We can now redo the original DOLS regression and get the standard errors fixed * by multiplying %XX (the X'X inverse matrix) by LAMBDASQ rather than the usual * %SEESQ. The new output is printed using LINREG(LASTREG,CREATE,FORM=CHISQUARED) * which reprints the last regression. The FORM=CHISQUARED indicates that the * variance scale factor is already incorporated into the covariance matrix. * linreg(noprint) rm # constant y r dy{-2 to 2} dr{-2 to 2} linreg(lastreg,create,covmat=%xx*lambdasq,form=chisquared,title="Dynamic OLS") * * (d) Chow test * set iv = -rv * scatter(footer="Figure 10.4 Plot of m-p-y against R",$ key=below,klabels=||"Until 1945","Since 1945"||) 2 # r iv * 1945:1 # r iv 1946:1 * * * Do separate SOLS and DOLS regressions for the two periods * (Table 10.3) * * SOLS * linreg rm 1903:1 1945:1;# constant y r linreg rm 1946:1 1987:1;# constant y r * * DOLS * clear resid linreg rm 1903:1 1945:1 resid # constant y r dy{-2 to 2} dr{-2 to 2} linreg(dfc=%nreg) resid;# resid{1 2} compute lambdasq=%seesq/(1-%sum(%beta))**2 linreg(noprint) rm 1903:1 1945:1 # constant y r dy{-2 to 2} dr{-2 to 2} linreg(lastreg,create,covmat=%xx*lambdasq,form=chisquared,title="Dynamic OLS") * clear resid linreg rm 1946:1 1987:1 resid # constant y r dy{-2 to 2} dr{-2 to 2} linreg(dfc=%nreg) resid;# resid{1 2} compute lambdasq=%seesq/(1-%sum(%beta))**2 linreg(noprint) rm 1946:1 1987:1 # constant y r dy{-2 to 2} dr{-2 to 2} linreg(lastreg,create,covmat=%xx*lambdasq,form=chisquared,title="Dynamic OLS") * * Formal test. Create a dummy for the 1946- period, and dummied versions * of y and r * set delta0 = t>=1946:1 set deltay = delta0*y set deltar = delta0*r linreg rm 1903:1 1987:1 resid # constant y r delta0 deltay deltar dy{-2 to 2} dr{-2 to 2} linreg(dfc=%nreg) resid; # resid{1 to 2} compute lambdasq=%seesq/(1-%sum(%beta))**2 linreg(noprint) rm 1903:1 1987:1 # constant y r delta0 deltay deltar dy{-2 to 2} dr{-2 to 2} linreg(lastreg,create,covmat=%xx*lambdasq,form=chisquared,title="Dynamic OLS") * * Test the dummies * exclude # delta0 deltay deltar