Download RATS Programming Manual, By Walter Enders

Transcript
Linear and Nonlinear Estimation 19
dif resids / dresids
lin(noprint) dresids 1961:4 *
# resids{1} dresids{1 to 8}
compute aic = %nobs*log(%rss) + 2*(%nreg)
compute sbc = %nobs*log(%rss) + (%nreg)*log(%nobs)
dis 'T-stat' %tstats(1) 'The aic = ' aic ' and sbc = ' sbc
The first line creates the first difference of resids as the series dresids. The next two lines instruct
RATS to regress dresidst on residst-1 and on dresids{1 to 8}. In order to ensure that all eight
regressions are estimated over the sample period, the start date on the LINREG instruction is
fixed at 1961:4. Since we are interested in only the t-statistic on residst-1, we suppress the output
using the NOPRINT option. Next, we calculate the Akaike Information Criterion (AIC) and the
Schwartz Bayesian Criterion (SBC) as:6
AIC = T ln(residual sum of squares) + 2n
SBC = T ln(residual sum of squares) + n ln(T)
where: n = number of parameters estimated, including the intercept term (if any),
and
T = number of usable observations.
We can use the internal variables constructed by LINREG to create AIC and SBC since:
%nobs
%rss
%nreg
The number of usable observations in the previously estimated model
The residual sum of squares in the previously estimated model
The number of regressors in the previously estimated model
Since %TSTATS(1) contains the t-statistic for the coefficient on residst-1, the last line displays
this t-statistic, the AIC and the SBC. Now, you could go back and rerun the routine after editing
the supplementary card for the LINREG instruction such that:
# resids{1} dresids{1 to 7}
However, to preview some of the material in the next chapter, it is more efficient to use RATS
programming language. We can embed the routine in a DO loop:
6
The formulas reported here and in the RATS User’s Manual are easily computable monotonic
transformations of the AIC and SBC. They will select the same model as the actual AIC and/or
SBC.