Lecture-9-Univariate-Time-Series-Modelling_Part-2 (2)
Lecture-9-Univariate-Time-Series-Modelling_Part-2 (2)
OlaOluwa S. Yaya
2022-12-04
Bibliography
• Box, G. E. P., and G. Jenkins. 1976. Time Series Analysis: Forecasting and Control. Second. San
Francisco: Holden Day.
• Racine, J. S. 2019. Reproducible Econometrics using R. Oxford University Press, New York.
• Schwarz, G. 1978. “Estimating the Dimension of a Model.” The Annals of Statistics 6:461–64.
• One way would be to estimate a set of candidate models and allow some model selection criteria to
determine which model is the best
• In what follows we consider the Bayes Information Criterion [@SCHWARZ:1978] and use the R
command BIC to compute the criterion function value for each of the candidate models (smaller values
are preferred)
• We consider two data generating processes for this exercise, one a non-stationary AR(1) containing a
time trend given by
yt = ayt−1 + bt + ϵt , |a| < 1
yt = yt−1 + d + ϵt
• We simulate two series plotted in the figure that follows, one from each process, and compute four
candidate models:
– A classical AR(1) model (‘Model yt ’ in what follows)
– A classical first-differenced AR(1) model (‘Model (1 − B)yt ’ in what follows)
1
– An augmented AR(1) model with a linear trend (‘Model yt − a − bt’ in what follows)
– An augmented first-differenced AR(1) model with a linear trend (‘Model (1 − B)(yt − ct)’ in what
follows)
• We present the BIC values for these models for each series in the table that follows
100
0
−100
Time
AR(1) RWD
Model yt 2392.883 2322.317
Model (1 − B)yt 2366.227 2306.183
Model yt − a − bt 2326.711 2320.778
Model (1 − B)(yt − ct) 2371.132 2311.251
• For the trend stationary AR(1) process, we observe that the BIC criterion selected Model yt − a − bt
(BIC = 2326.711)
2
• For the non-stationary random walk with drift, we can see that the BIC criterion selected Model
(1 − B)yt (BIC = 2306.183)
• The model selection criteria that we study later in the course therefore appear to have the ability to
distinguish between these two cases
• Note, however, that these selection procedures are based on a random sample and are not guaranteed
to deliver the true model in applied settings, even in the unlikely event that it was contained in the set
of candidate models
3
Forecasts from ARIMA(4,0,0) with non−zero mean
Data
6000
fitted(model)
forecast(model,h=10)
4000
2000
0
−2000
4
3
2
1
0
−1
−2
Standardized Residuals
Time
ACF of Residuals
1.0
0.8
0.6
ACF
0.4
0.2
0.0
−0.2
0 5 10 15 20
Lag
0.4
0.2
0.0
2 4 6 8 10
lag
5
Seasonal ARIMA(p, d, q)(P, D, Q)m Models
Example - ARIMA(1, 1, 1)(1, 1, 1)4
• An ARIMA(1, 1, 1)(1, 1, 1)4 model (without a constant) constructed for quarterly data (m = 4) can be
expressed as
(1 − ϕ1 B)(1 − Φ1 B 4 )(1 − B)(1 − B 4 )yt = (1 − θ1 B)(1 − Θ1 B 4 )ϵt
• So,
6
• Therefore, there is nothing new about these models when it comes to properties, estimation, forecasting,
forecast errors, and forecast error variances
• We can leverage existing results for identification (white noise tests etc.)
• Here we might use both ndiffs() and nsdiffs() in addition to the acf() and pacf() functions
• We can also use auto.arima() for identifying a candidate model
7
Seasonal plot: euretail
2007
2006
2005
2008
100
2004
2003
2009
2002
2010
2000
96 2011
2001
1999
1998
92
1997
1996
Q1 Q2 Q3 Q4
Quarter
Data
fitted(model)
forecast(model,h=10)
98
96
94
92
90
88
8
• Make sure that the fpp package is installed prior to running this code
• We also present a figure with the time series, fitted values, and predictions along with prediction
intervals for h=24 step-ahead forecasts
1994
0.75 2008 1992
1991
0.50
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Month
9
Forecasts from ARIMA(3,1,1)(0,1,1)[12]
1.4
Data
fitted(model)
1.2
forecast(model,h=24)
1.0
0.8
0.6
0.4
External Predictors
• Sometimes you may have additional predictor variables that you believe affect yt but are not themselves lagged
values of either yt or ϵt
10
• These predictors (often called external predictors) turn out to be straightforward to incorporate in the
ARIMA(p, d, q)(P, D, Q)m framework
• They simply appear as additional explanatory variables on the right hand side of the model
• In R, the arima(), Arima() and auto.arima() functions support the arguments xreg=
• Note that xreg is an optional vector or matrix of external predictors, which must have the same number of
rows as y
2500 1970
1976
1978
1977
1979
1975
1971
1973
1969
1982
1974
2000
1980
1984
1981
1500 1983
1000
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Month
Figure 4: ‘ggseasonplot‘ of Monthly Totals of Car Drivers in Great Britain Killed or Seriously Injured January
1969 to December 1984.
11
• Note that the external predictor seatbelt is and accounts for an average decrease of deaths or serious injuries
per month
12