UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics
Economics 143 (Cameron) - Applied Regression
Analysis
SHAZAM code [intlab9.sha]
* SHAZAM code downloaded from UCLA Econ 143 (CAMERON) WebSite:
* HTML file called e143sh17.htm, and should have
* been downloaded as intlab9.sha
smpl 1 154
read(int2.dat) obs p yp m1 m2 r
stat / pcor
* date might be more informative than the usual t variable:
genr date=1959+(time(-1)/4)
* annual inflation rate is four times quarterly inflation rate
* make sure it is expressed in percent, rather than decimal percent:
genr infl=( 4*(p-lag(p))/p )*100
* any model using infl directly or indirectly loses the first observation
sample 2 154
* real interest rate is nominal rate less inflation
genr realr=r-infl
* express money stocks and gnp in real terms (1992 dollars)
* real m1
genr realm1=(m1/p)*100
* real m2
genr realm2=(m2/p)*100
* real gnp
genr realyp=(yp/p)*100
* check to make sure the numbers make sense
print r infl realr
* try some simple regressions first
ols realr realyp
ols realr realm2
* now try a multiple regression, checking for multicollinearity
* save the residuals
ols realr realyp realm2 / resid=e predict=fitols exactdw auxrsqr
* quarterly data: check for first- and fourth-order autoregressive errors
* also called AR(1) and AR(4) errors
genr elag=lag(e)
genr elag1=lag(e,1)
genr elag2=lag(e,2)
genr elag3=lag(e,3)
genr elag4=lag(e,4)
* adjust sample
sample 3 154
plot e elag
sample 6 154
plot e elag4
ols e elag1 elag2 elag3 elag4
sample 2 154
auto realr realyp realm2 / predict=fitauto rstat
auto realr realyp realm2 / order=2 predict=fitauto2 rstat
* since these are quarterly data, suspect AR(4) errors
auto realr realyp realm2 / order=4 predict=fitauto4 rstat
* look at all the data
* look at how nominal interest, inflation, and real interest move
plot r infl realr date / gnu line
* plot all of the variables used in the model
plot realr realyp realm2 date / gnu line
* check multicollinearity
plot realyp realm2 / gnu line
* look at the fit from an ols model
plot fitols realr date / gnu line
* look for patterns in ols residuals
plot e date / gnu line
* look at the fit from an AR(1) error model
plot fitauto realr date / gnu line
* look at the fit from an AR(2) error model
plot fitauto2 realr date / gnu line
* look at the fit from an AR(4) error model
plot fitauto4 realr date / gnu line
ols realr realyp realm2 / list
Updated: 12/7/98; Prepared by: Trudy Ann Cameron; Site Index