*
* @GMAutoFit(options) series start end
* does an automatic fit of a multiplicative seasonal ARMA model to a
* series following the procedure described in Gomez and Maravall,
* "Automatic Modeling Methods for Univariate Series", in Peņa, Tiao and
* Tsay, eds., "A Course in Time Series Analysis", New York: Wiley, 2001.
*
* Parameters:
* series Series to analyze
* start end Range to analyze [range of series]
*
* Options
* DIFF=number of regular differencings[0]
* SDIFFS=number of seasonal differencings[0]
* CONST/[NOCONST] Include constant in all models
* REGULAR=maximum number of regular AR or MA parameters (each polynomial) [2]
* SEASONAL=maximum number of seasonal AR or MA parameters (each polynomial) [1]
* FULL/[NOFULL] FULL does an exhaustive search rather than the GM search
* REPORT/[NOREPORT] shows a table with all the models examined
* TITLE=title for report ["Search for Minimum BIC Model"]
*
* Description:
* @GMAUTOFIT searches for an approximate minimum BIC model with the
* maximum size of the polynomials governed by REGULAR for the AR and MA
* and SEASONAL for the seasonal AR and seasonal MA. Rather than attempt
* an exhaustive search across all four simultaneously (though you can do
* that with the FULL option), it first fixes the "regular" ARMA parameters
* at ARMA(3,0), then does an exhaustive search over the seasonal parameters
* only. Once those are chosen, they are fixed and an exhaustive search is
* done for the regular ARMA parameters.
*
* Defines:
* %%AUTOP,%%AUTOQ,%%AUTOPS,%%AUTOQS are the chosen number of regular AR,
* regular MA,seasonal AR and seasonal MA lags
*
procedure GMAutoFit series start end
type series series
type integer start end
*
option integer diffs 0
option integer sdiffs 0
option integer regular 2
option integer seasonal 1
option switch const 0
option switch report 0
option switch full 0
option string title
*
local real ic bestic
local integer p q ps qs
local integer blockrow
local integer plower pupper qlower qupper
local report gmreport
local string ltitle
*
declare integer %%autop %%autoq %%autops %%autoqs
if report {
if %defined(title)
compute ltitle=title
else
compute ltitle="Search for Minimum BIC Model"
report(use=gmreport,action=define,title=ltitle)
report(use=gmreport,atrow=1,atcol=1,span) ltitle
report(use=gmreport,atrow=2,atcol=1,span) "Series "+%label(series)
report(use=gmreport,atrow=3,atcol=1,span) "with "+diffs+" regular and "+sdiffs+" seasonal differences"
report(use=gmreport,atrow=5,atcol=1,align=center) "AR" "MA" "AR(s)" "MA(s)" "LogL" "BIC"
}
*
* For the GM search, fix the regular ARMA model at (3,0) and do an exhaustive
* search over the seasonal parameters.
*
if full
compute plower=0,pupper=regular,qlower=0,qupper=regular,blockrow=%reportrow+1
else
compute plower=3,pupper=3,qlower=0,qupper=0
*
compute bestic=%na
do p=plower,pupper
do q=qlower,qupper
do ps=0,seasonal
do qs=0,seasonal
boxjenk(ar=p,ma=q,sar=ps,sma=qs,$
diffs=diffs,sdiffs=sdiffs,const=const,cvcrit=.001,noprint,maxl,method=bfgs) series start end
compute ic=-2.0*%logl+%nreg*log(%nobs)
if report ; report(use=gmreport,row=new,atcol=1) p q ps qs %logl ic
if .not.%valid(bestic).or.ic