Table Of ContentStatistics and Computing
Víctor Gómez
Linear Time Series
with MATLAB
and OCTAVE
QUANTLETS
Statistics and Computing
SeriesEditor
WolfgangKarlHärdle,Humboldt-UniversitätzuBerlin,Berlin,Germany
Statistics and Computing (SC) includes monographs and advanced texts on
statisticalcomputingandstatisticalpackages.
Moreinformationaboutthisseriesathttp://www.springer.com/series/3022
Víctor Gómez
Linear Time Series with
MATLAB and OCTAVE
123
VíctorGómez
GeneralDirectorateofBudgets
MinistryofFinanceandPublic
Administrations
Madrid,Spain
Quantletsmay bedownloaded fromhttp://extras.springer.com or viaalink onhttp://www.
springer.com/978-3-030-20789-2orwww.quantlet.orgforarepositoryofquantlets.
ISSN1431-8784 ISSN2197-1706 (electronic)
StatisticsandComputing
ISBN978-3-030-20789-2 ISBN978-3-030-20790-8 (eBook)
https://doi.org/10.1007/978-3-030-20790-8
MathematicsSubjectClassification(2010):62-01,62-02,62-04,62-07,62M15,62M10,62M20,62J05
©SpringerNatureSwitzerlandAG2019
Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof
thematerialisconcerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation,
broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionorinformation
storageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodology
nowknownorhereafterdeveloped.
Theuseofgeneraldescriptivenames,registerednames,trademarks,servicemarks,etc.inthispublication
doesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfromtherelevant
protectivelawsandregulationsandthereforefreeforgeneraluse.
Thepublisher,theauthors,andtheeditorsaresafetoassumethattheadviceandinformationinthisbook
arebelievedtobetrueandaccurateatthedateofpublication.Neitherthepublishernortheauthorsor
theeditorsgiveawarranty,expressorimplied,withrespecttothematerialcontainedhereinorforany
errorsoromissionsthatmayhavebeenmade.Thepublisherremainsneutralwithregardtojurisdictional
claimsinpublishedmapsandinstitutionalaffiliations.
ThisSpringerimprintispublishedbytheregisteredcompanySpringerNatureSwitzerlandAG.
Theregisteredcompanyaddressis:Gewerbestrasse11,6330Cham,Switzerland
To mywifeMaríaC.
and
mydaughterBerta
Preface
Themotivationofthisbookistoprovidetimeseriesstudentsandresearcherswitha
softwarepackagecalledSSMMATLAB,writteninMATLAB,thatwillallowthem
to work with general state space models. Since many time series models used in
practicecanbeputintostatespaceform,specialfunctionshavebeenwrittenforthe
mostusualones,suchasmultiplicativeARIMAandVARMAmodels,cointegrated
VARMA models, VARMAX models in echelon form, transfer function models,
univariate structural models, like those considered by Harvey (1993, Chap. 4)
or Kitagawa and Gersch (1996), and ARIMA model-based (AMB) unobserved
components models (Gómez and Maravall 2001). However, if the user intends to
workwithmoresophisticatedstatespacemodelsthatarenotavailableinstandard
commercialpackagesfortimeseriesanalysisoreconometrics,he/shecanprogram
his/herownmodelinSSMMATLABandcarryoutmodelestimation,interpolation,
forecasting,andsmoothing.
All the programscontainedin SSMMATLAB can also runin the free software
OCTAVE platform. The series can be univariate or multivariate and the state
space model can be very general. It may have time-varying system matrices,
exogenousinputs,regressioneffects,incompletelyspecifiedinitialconditions,such
asthosethatarisewithnonstationaryVARMAmodels,andmissingvalues.Abrief
descriptionofSSMMATLABappearedinGómez(2015).
Thebookprovidesaquicktheoreticaldescriptionofa widevarietyoftopicsin
Time Series, togetherwith manyexamplesusing SSMMATLABto illustrate each
subject. Many of the examples in the book can be found as Quantlets in Gómez
(2019),whereSSMMATLABcanalso bedownloaded.Wheneverthe readerfinds
an examplein which the logo followedby some name appears,thismeansthat
this is a link to the correspondingquantletwith the same name where the code to
producethepictureortheresultsintheexampleislocated.Inthisconnection,itis
tobenotedthatinthelinktotheQuantletplatform,www.quantlet.de,onecanfind
allthecontentprovidedathttps://github.com/QuantLet.
ThecompanionbookGómez(2016)containsthetheoreticalmaterialneededto
develop most of the functions used in SSMMATLAB. The user is encouraged to
vii
viii Preface
consultthisbookinordertounderstandtheprogrammingofmanyofthealgorithms
usedinthesefunctions.
Finally, I would like to thank several people who have helped in some way to
develop this project. In particular, thanks are given to Juan Varela of the Spanish
Ministry of Finance, Félix Aparicio and Luis Sanguiao of the Spanish National
Statistical Institute, and Riccardo Corradini of the Italian National Statistical
Institute.
The book is organized as follows. A quick introduction to SSMMATLAB is
provided in Chap.1, where some examples are given of the most widely used
models in practice. In the rest of the chapters, for each topic in time series
analysis,atheoreticalintroductionisgivenfirst,followedbysomeillustrationwith
SSMMATLAB. More specifically, in Chap.2, stationarity, VARMA and ARIMA
models are considered. VARMAX and transfer function models are described in
Chap.3. Unobserved components in univariate series is the subject of Chap.4.
Chapter 5 is dedicated to spectral analysis. The computation of echelon forms
for VARMAX and state space models by polynomial methods is the subject of
Chap.6.InChap.7,severalexamplesofmultivariatestructuralmodelsarepresented
thatcannotbehandledwithstandardcommercialpackages.CointegratedVARMA
modelsareconsideredinChap.8.Chapter9showshowARIMA,VARMA,VAR-
MAX, and time invariant state space models can be simulated in SSMMATLAB.
The state space model is the subject of Chap.10. All the examples contained in
SSMMATLABarelistedbysubjectinChap.11.
Madrid,Spain VíctorGómez
August2019
Software Installation
ToinstallSSMMATLAB,uncompressthezipfilecontainedinthedirectoryToolbox
ofthewebpageGómez(2019)andcopyitscontentsintoa directory,forexample
SSMMATLAB. Apart from the files with extension m (MATLAB m-files), there
shouldbe six subdirectorieswith namesDATA,RESULTS, SPEC, GRAPHS, and
USMSPEC.AllthedatafilesusedinthedemosareinthesubdirectoryDATA.The
subdirectoryRESULTS is where allprogramresultsare written. The subdirectory
GRAPHS is used to eventually write the plots produced by the programs. In the
subdirectory SPEC, you can find all specification files for the different ARIMA
andtransferfunctiondemos.Thatis,eachspecificationfilecontainsinstructionsto
readdata,generatestructures,etc.Finally,thesubdirectoryUSMSPEChasthesame
functionasthesubdirectorySPECbutforunivariatestructuralmodels.
Iftheuserdesirestoworkinadirectorydifferenttotheoneinwhichtheprogram
has been installed, he/she should first add to the MATLAB path the directory
whereSSMMATLABhasbeeninstalled.Then,ifthenewdirectoryinwhichthe
userintendstoworkiscalledWORK,forexample,theusercanstartworkingwith
SSMMATLAB in that directory without having to create any subdirectory. Some
oftheprogramsusedbySSMMATLAB,forexamplethosethatdealwithARIMA,
transferfunction,orunivariatestructuralmodels,canoptionallyandautomatically
create two subdirectories in WORK, called RESULTS and GRAPHS, where the
programresultsandplotsarewritten.
AllthefunctionsinSSMMATLABhavebeenprovedtoalsorununderthefree
softwareOCTAVEplatform.
References
Gómez,V.(2015).Ssmmatlab:Asetofmatlabprogramsforthestatisticalanalysis
of state spacemodels.JournalofStatisticalSoftware,66(9),1–37.http://www.
jstatsoft.org/v66/i09/
ix
x SoftwareInstallation
Gómez, V. (2016). Multivariate time series models with linear state space struc-
ture.NewYork:Springer.
Gómez,V.(2019).SSMMATLAB.https://github.com/QuantLet/ssmmatlab
Gómez, V., & Maravall, A. (2001). Seasonal adjustment and signal extraction in
economictime series.In D.Peña,G. C. Tiao,&R. S. Tsay (Eds.),A coursein
timeseriesanalysis(chap.8).NewYork:Wiley.
Harvey,A. C. (1993).Time series models(2nded.).HemelHempstead:Harvester
Wheatsheaf.
Kitagawa,G.,&Gersch,W.(1996).Smoothnesspriorsanalysisoftimeseries.New
York:Springer.