*
* REGARIMA.RPF
* Estimation of a RegARIMA model (regression with ARIMA error process).
*
* RATS Version 9, User's Guide, Example from Section 6.4.4.
*
cal(m) 1972:7
open data houseapplsales.xls
data(format=xls,org=columns) 1972:07 1988:06 houseapplsales
*
* Generate trading day regressors. These are the differences between the
* counts of each day of the week falling in a month (Monday=1, ...,
* Saturday=6) from the number of Sundays.
*
dec vect[series] td(6)
do i=1,6
set td(i) = %tradeday(t,i)-%tradeday(t,7)
end do i
*
* Generate a leap year shift for Februaries. This sums to zero across a
* four year cycle.
*
set lpyr = %if(%period(t)==2,-.25+(%clock(%year(t),4)==4),0.0)
*
set logsales = log(houseapplsales)
*
* Regress log sales on 1 and the shifts. (This could also have been done
* using LINREG).
*
boxjenk(gls) logsales
# constant td lpyr
*
* Identify the noise model. The "airline" model of an
* ARIMA(0,1,1)x(0,1,1) seems appropriate.
*
@bjident(diffs=1,sdiffs=1) %resids
boxjenk(gls,diffs=1,sdiffs=1,ma=1,sma=1) logsales
# constant td lpyr
*
* Drop the apparently unnecessary MA term, check for additive outliers,
* and generate the trading day adjustment series based on the regression.
*
boxjenk(gls,diffs=1,sdiffs=1,sma=1,outlier=ao,$
adjust=tdadjust) logsales
# constant td lpyr
*
* This gives the "calendar" adjusted series.
*
set adjusted = logsales-tdadjust