set nowide smpl 1 246 **** creating seasonal dummies **** genr s=seas(12,1) genr d1 = s + lag(s,1) + lag(s,2) genr d2 = lag(s,3) + lag(s,4) + lag(s,5) genr d3 = lag(s,6) + lag(s,7) + lag(s,8) **** reading in data **** sample 1 247 file 11 cpi.dat file 12 part.dat file 13 irate.dat file 14 gdp.dat file 15 exch.dat file 16 y1.dat read(11) cpi read(12) part read(13) i read(14) gdp read(15) exch read(16) y1 * sample 247 247 print cpi part i gdp exch y1 **** deflating data with cpi **** sample 1 246 genr y = (y1/cpi) * 100 genr realgdp = (gdp/cpi)*100 sample 2 246 genr inflat=(cpi-lag(cpi))/lag(cpi) genr reali= i - inflat * **** creating explanatory variables **** sample 3 246 genr lagy=lag(y) genr x1 = part genr x2 = reali - lag(reali) genr x3 = (realgdp - lag(realgdp))/lag(realgdp) genr x4 = exch * **** model estimation and testing **** * (1) Covariance matrix to check for potential for multicollinearity * If the explanatory variables are highly correlated, then the F-tests * below may display evidence of problems due to multicollinearity stat x1 x2 x3 x4 lagy/pcor * (2) Multiregression estimation ols y lagy x1 x2 x3 x4 d1 d2 d3/noanova rstat resid=err predict=yhat dlag ************************************************************************* * (3) F-tests on subsets of regressors * Note: If the t-tests on a subset of regressors is insignificant but the * F-test on that subset of regressors is significant, then we have * evidence of multicollinearity. test test x1=0 test x2=0 test x3=0 end test test x1=0 test x2=0 test x4=0 end test test x1=0 test x3=0 test x4=0 end test test x1=0 test x2=0 test x3=0 test x4=0 end ************************************************************************* * **** checking for heteroskedasticity ***** * (1) Visual test by plotting residual square to y genr errsq=err**2 plot errsq yhat/nopretty nowide * (2) Formal test -- LM test ?ols errsq yhat/noanova gen1 lmstat=$n*$r2 print lmstat stop