Tutorial 3
Sunil
27 August 2017
Contents
1 Introduction 1
2 MA process 1
2.1 MA(1) process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2.2 MA(2) Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 MA(q) process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 AR Process 6
3.1 AR1 Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 AR(2) process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 ARMA Process 16
5 Assignments and Homework 17
1 Introduction
This tutorial examines the properties of stationary univariate models using simulated data. The functions
used to generate graphs are given in Graph.R script.You can load the function using source() function.
source("graphs.R")
2 MA process
The function arima.sim() is used to simulate the series from ARMA(p,q) process of different order. ARMAacf()
gives the theoretical ACF and PACF. ARMAtoMA() gives the impulse response coefficients. I have used these
two functions to generate the graphs of ACF and IRF. See help for details.
2.1 MA(1) process
Let us start with MA(1) process. The details of AR and MA coefficients need to be specified as arguments in
arima.sim(). The following codes first define AR and MA terms and them simulate the process.
library(grid)
library(gridExtra)
library(ggplot2)
set.seed(123)
ma1 <- 1.8 # define the MA coefficients
ar1 <- 0 # define the AR coefficient
mu <- 2
model1 <- list(ma = ma1, ar = ar1)
s11 <- mu + arima.sim(model = model1, n = 250)
1
# ANother MA model with coeffient -0.8
ma2 <- -0.8
ar1 <- 0
model2 <- list(ma = ma2, ar = 0)
s12 <- mu + arima.sim(model = model2, n = 250)
Two MA(1) process is simulated, one with 0.8 and other with 0.8 as MA coefficients. Correlogram of these
series are given below.
library(latex2exp)
# ts.graph1() is from graph.R. It plots the time series
gs11 <- ts.graph1(s11) + ggtitle(TeX("$Y_t=2+0.8 \\epsilon_{t-1}+\\epsilon_{t}$"))
gs12 <- ts.graph1(s12) + ggtitle(TeX("$Y_t=2-0.8 \\epsilon_{t-1}+\\epsilon_{t}$"))
grid.arrange(gs11, gs12, acf.graph1(ar1, ma1, 15), acf.graph1(ar1,
ma2, 15), pacf.graph1(ar1, ma1, 15), pacf.graph1(ar1, ma2,
15), ncol = 2)
Yt=2+0.8t1 + t Yt=20.8t1 + t
7.5
5.0 5.0
2.5 2.5
0.0 0.0
2.5
0 50 100 150 200 250 0 50 100 150 200 250
Periods Periods
0.4 0.0
0.1
0.3
ACF
ACF
0.2
0.2
0.3
0.1 0.4
0.0 0.5
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
0.4 0.0
0.1
PACF
PACF
0.2 0.2
0.0 0.3
0.4
0.2 0.5
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
The plot of Yt shows that the series is distributed around its mean.
ACF of MA(1) with 0.8 is positive and cuts off at lag one. PACF oscillates between negative and
positive values (Why?).
ACF of MA(1) with -0.8 is negative and cuts off at lag one. All the PAC are negative and PACF decays
to zero(Why?)
Both models are invertible. You can get the numerical values of ACF using ARMAacf(). See help for
details. (I have customized the graphs using own function sgiven in the sript attached, but you can plot
IRF and ACF directly)
2
2.2 MA(2) Process
Higher order MA and AR can be specified using c(). The coefficients needs to be given in order.
set.seed(123)
ma21 <- c(1, 0.7) # MA coefficient
ar1 <- 0 # AR coefficient
mu <- 2
model21 <- list(ma = ma21, ar = ar1)
s21 <- mu + arima.sim(model = model21, n = 250)
# ANother MA model with coeffients 1 and -0.25
ma22 <- c(-1.2, 0.25)
model22 <- list(ma = ma22, ar = ar1)
s22 <- mu + arima.sim(model = model22, n = 250)
We have simulated two invertible MA(2) process i.e Y1t = 2 + 1t1 + 0.7t2 + t and Y2t = 2 1.2t1 +
0.25t2 + t . Remember for invertibility the roots of the lag polynomial should be greater than |1| or its
inverse should be less than |1|.
2.2.1 Invertibility
Consider the first process
Y1t = 2 + 1t1 + 0.7t2 + t
The roots of lag polynomial(1 + 1L + 0.7L2 ) are:
polyroot(c(1, 1, 0.7))
## [1] -0.7142857+0.9583148i -0.7142857-0.9583148i
Roots are complex conjugates. Absolute value of these roots are :
abs(polyroot(c(1, 1, 0.7)))
## [1] 1.195229 1.195229
Since the roots are greater than |1|, Yt is invertible. The inverse of these roots are given below.
(polyroot(c(1, 1, 0.7)))^{
-1
}
## [1] -0.5-0.6708204i -0.5+0.6708204i
abs((polyroot(c(1, 1, 0.7)))^-1)
## [1] 0.83666 0.83666
MA(2) process can also be written in terms of t as follows:
t = 1t1 0.7t2 + Yt
In vector form it becomes
t 1 0.7 t1 Y
= + t
t1 1 0 t2 0
t = Bt1 + Yt
The inverse of the root of MA lag polynomial is nothing but the eigen values of B matrix. Remember that
for invertibility the eigen values should be less than |1|.
3
(aa <- rbind(-ma21, c(1, 0)))
## [,1] [,2]
## [1,] -1 -0.7
## [2,] 1 0.0
eigen(aa)$values
## [1] -0.5+0.6708204i -0.5-0.6708204i
abs(eigen(aa)$values)
## [1] 0.83666 0.83666
Second Process:
Y2t = 2 1.2t1 + 0.25t2 + t
The roots of lag polynomial(1 + 1L + 0.7L2 ) are
polyroot(c(1, -1.2, 0.25))
## [1] 1.07335-0i 3.72665+0i
abs(polyroot(c(1, -1.2, 0.25)))
## [1] 1.07335 3.72665
Since the roots are greater than |1|, Yt is invertible.\ In vector form t = 1.2t1 + 0.25t2 + Yt can be
written as:
1.2 0.25 t1
t Y
= + t
t1 1 0 t2 0
Eigen Values are:
(aa <- rbind(-ma22, c(1, 0)))
## [,1] [,2]
## [1,] 1.2 -0.25
## [2,] 1.0 0.00
eigen(aa)$values
## [1] 0.9316625 0.2683375
# abs(eigen(aa)$values)
Plots of both series with ACF and PACF are given below. The first two ACF are non zero for both the
process. The structure of PACF will be determined by the nature of roots.
tgs21 <- TeX("$Y_t=2+1\\epsilon_{t-1}+0.7\\epsilon_{t-2}+\\epsilon_{t}$")
gs21 <- ts.graph1(s21) + ggtitle(tgs21)
tgs22 <- TeX("$Y_t=2-1.2\\epsilon_{t-1}+0.25\\epsilon_{t-2}+\\epsilon_{t}$")
gs22 <- ts.graph1(s22) + ggtitle(tgs22)
grid.arrange(gs21, gs22, acf.graph1(ar1, ma21, 15), acf.graph1(ar1,
ma22, 15), pacf.graph1(ar1, ma21, 15), pacf.graph1(ar1, ma22,
15), ncol = 2)
4
Yt=2+1t1+0.7t2 + t Yt=21.2t1+0.25t2 + t
7.5
4 5.0
2 2.5
0 0.0
2 2.5
0 50 100 150 200 250 0 50 100 150 200 250
Periods Periods
0.6 0.0
ACF
ACF
0.4 0.2
0.2 0.4
0.0 0.6
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
0.0
0.50
PACF
0.25 PACF 0.2
0.00 0.4
0.25
0.6
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
What happens to PACF if MA(2) is not invertible?
2.3 MA(q) process
Consider and MA(4)as follows:
Yt = 0.4t1 + 0.2t2 + 0.15t1 0.55t4 + t
You can easily verify the invertibility of process by checking the eigen values or roots of the MA lag polynomial.\
Roots of the MA lag polynomial are:
abs(polyroot(c(1, 0.4, 0.2, 0.15, -0.55)))
## [1] 1.098094 1.035962 1.098094 1.455507
Eigen values of B matrix are
ma41 <- c(0.4, 0.2, 0.15, -0.55)
(aa <- rbind(-ma41, c(1, 0, 0, 0), c(0, 1, 0, 0), c(0, 0, 1,
0)))
## [,1] [,2] [,3] [,4]
## [1,] -0.4 -0.2 -0.15 0.55
## [2,] 1.0 0.0 0.00 0.00
## [3,] 0.0 1.0 0.00 0.00
## [4,] 0.0 0.0 1.00 0.00
eigen(aa)$values
5
## [1] -0.9652866+0.0000000i -0.0608795+0.9086315i -0.0608795-0.9086315i
## [4] 0.6870456+0.0000000i
abs(eigen(aa)$values)
## [1] 0.9652866 0.9106687 0.9106687 0.6870456
2.3.1 ACF and PACF of MA(4)
grid.arrange(acf.graph1(ar1, ma41, 15), pacf.graph1(ar1, ma41,
25), ncol = 2)
0.2 0.2
PACF
ACF
0.0 0.0
0.2 0.2
1 5 9 13 1 5 9 13 17 21 25
Period(lags) Period(lags)
The shape of PACF depends on eigen values and the behavior of PACF will be dominated by the nature of
prominent eigen value as lags increase(However it is difficult to predict the shape if all the roots have same
magnitude as in this example). The prominent root of the MA(4) process is real and negative, hence the
PACF oscillates between negative and positive values and this pattern becomes clear as lags increases.
In general:
ACF can be used to identify order of an MA process
PACF of an invertible series can exhibit damned decay or cycles depending on the roots of MA lag
polynomial.
3 AR Process
3.1 AR1 Process
Three AR(1) models are simulated with 0.8, -0.7 and 0.4 auto regressive coefficient. The impulse responses of
AR models are also plotted in this section. Use ARMAtoMA() to get the numerical values of IRF.
set.seed(123)
ma1 <- 0 # MA coefficient
ar1 <- 0.8 # AR coefficient
mu <- 2
model1 <- list(ma = ma1, ar = ar1)
a11 <- mu + arima.sim(model = model1, n = 250)
# ANother AR process with coeffient 0.4
6
ar2 <- 0.4
model2 <- list(ma = ma1, ar = ar2)
a12 <- mu + arima.sim(model = model2, n = 250)
ga11 <- ts.graph1(a11) + ggtitle(TeX("$Y_t=0.4+0.8 Y_{t-1}+\\epsilon_{t}$"))
ga12 <- ts.graph1(a12) + ggtitle(TeX("$Y_t=1.2+0.4 Y_{t-1}+\\epsilon_{t}$"))
grid.arrange(ga11, ga12, acf.graph1(ar1, ma1, 15), acf.graph1(ar2,
ma1, 15), pacf.graph1(ar1, ma1, 15), pacf.graph1(ar2, ma1,
15), ncol = 2)
Yt=0.4+0.8Yt1 + t Yt=1.2+0.4Yt1 + t
6 4
4 3
2 2
0 1
2 0
1
0 50 100 150 200 250 0 50 100 150 200 250
Periods Periods
0.8 0.4
0.6 0.3
ACF
ACF
0.4 0.2
0.2 0.1
0.0 0.0
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
0.8 0.4
0.6 0.3
PACF
PACF
0.4 0.2
0.2 0.1
0.0 0.0
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
AR(1) is persistent if the coefficient is close to one.
Unconditional mean is 2 for all the series
Convergence of ACF to zero is slower for AR(1) process with 0.8 coefficient.
The ACF will oscillate between positive and negative values if auto regressive coefficient is negative.
See the graph below.
AR Process can be identified using PACF. For AR(1) PACF cut off at lag one.
# Process with negative autoregrssive coefficient
ar3 <- -0.7
model3 <- list(ma = ma1, ar = ar3)
a13 <- mu + arima.sim(model = model3, n = 250)
ga13 <- ts.graph1(a13) + ggtitle(TeX("$Y_t=3.4-0.7 Y_{t-1}+\\epsilon_{t}$"))
7
grid.arrange(ga13, acf.graph1(ar3, ma1, 15), ncol = 2)
Yt=3.40.7Yt1 + t 0.50
0.25
ACF
5.0 0.00
2.5 0.25
0.0 0.50
2.5 0.75
0 50 100 150 200 250 1 5 9 13
Periods Period(lags)
The IRF is same as ACF for AR(1) process.
All the IRFs are generated by giving one unit shock at time period 0(red dot in the plot).
For a co-variance stationary process the IRF should approach zero as lag increases and plots of IRF
behaves as expected.
The cumulative IRF shows the total effect,as expected it also converges to a constant.
Model-1:IRF of Yt = 0.4 + 0.8Yt1 + t
grid.arrange(irf.graph1(ar1, ma1, 20), cirf.graph1(ar1, ma1,
20), ncol = 2)
4
Accumulated IR
Shock
0.9 3
0.6 2
IR
1
0.3
0
0.0 1 5 9 13 17
1 5 9 13 17 Period after the shock
Model-2:IRF of Yt = 1.2 + 0.4Yt1 + t
grid.arrange(irf.graph1(ar2, ma1, 20), cirf.graph1(ar2, ma1,
20), ncol = 2)
Accumulated IR
Shock
0.6
0.9
0.4
0.6
IR
0.2
0.3
0.0
0.0 1 5 9 13 17
1 5 9 13 17 Period after the shock
8
Model-3:IRF of Yt = 3.4 0.7Yt1 + t
grid.arrange(irf.graph1(ar3, ma1, 20), cirf.graph1(ar3, ma1,
20), ncol = 2)
0.0
Accumulated IR
1.0 Shock
0.2
0.5
IR
0.4
0.0
0.6
0.5
1 5 9 13 17
1 5 9 13 17 Period after the shock
3.2 AR(2) process
Four different models of AR(2) process is considered for simulation
1. Yt = 0.5Yt1 + 0.25Yt2 + t
2. Yt = 1Yt1 0.25Yt2 + t
3. Yt = 1.5Yt1 0.75Yt2 + t
4. Yt = 0.6Yt1 + 0.2Yt2 + t
set.seed(123)
ma1 <- 0 # MA coefficient
ar21 <- c(0.5, 0.25) # AR coefficient
mu <- 0
model21 <- list(ma = ma1, ar = ar21)
a21 <- mu + arima.sim(model = model21, n = 250)
# ANother MA model with coeffients 1 and -0.25
ar22 <- c(1, -0.25)
model22 <- list(ar = ar22, ma = ma1)
a22 <- mu + arima.sim(model = model22, n = 250)
# ANother MA model with coeffients 1 and -0.25
ar23 <- c(1.5, -0.75)
model23 <- list(ma = ma1, ar = ar23)
a23 <- mu + arima.sim(model = model23, n = 250)
# ANother MA model with coeffients 1 and -0.25
ar24 <- c(-0.6, 0.2)
model24 <- list(ma = ma1, ar = ar24)
a24 <- mu + arima.sim(model = model24, n = 250)
ga24 <- ts.graph1(a24) + ggtitle(TeX("$Y_t=-0.6 Y_{t-1}+0.2Y_{t-2}\\epsilon_{t}$"))
ga23 <- ts.graph1(a23) + ggtitle(TeX("$Y_t=1.5 Y_{t-1}-0.75Y_{t-2}\\epsilon_{t}$"))
ga21 <- ts.graph1(a21) + ggtitle(TeX("$Y_t=0.5 Y_{t-1}+0.25Y_{t-2}\\epsilon_{t}$"))
ga22 <- ts.graph1(a22) + ggtitle(TeX("$Y_t=1 Y_{t-1}-0.25Y_{t-2}\\epsilon_{t}$"))
grid.arrange(ga21, ga22, ga23, ga24, ncol = 2)
9
Yt=0.5Yt1+0.25Yt2t Yt=1Yt10.25Yt2t
4
2
2
0
0
2 2
0 50 100 150 200 250 0 50 100 150 200 250
Periods Periods
Yt=1.5Yt10.75Yt2t Yt=0.6Yt1+0.2Yt2t
4 2.5
0 0.0
4 2.5
8 5.0
0 50 100 150 200 250 0 50 100 150 200 250
Periods Periods
3.2.1 Stationarity
We can check the stationarity
of this model using the roots of the AR lag polynomial or the eigen values of F
1 2
matrix,where F = form the matrix form of AR(2) Zt = FZt1 + vt . We will check the stationarity
1 0
using eigen values. You may check the roots of AR lag polynomial using polyroot(). Eigen values of all the
four models are given below.
Model1:Yt = 0.5Yt1 + 0.25Yt2 + t
# F matrix
(ar21F <- rbind(ar21, c(1, 0)))
## [,1] [,2]
## ar21 0.5 0.25
## 1.0 0.00
# Eigen Values
(ar21r <- eigen(ar21F)$values)
## [1] 0.809017 -0.309017
# Abs of eigen values
abs(ar21r)
## [1] 0.809017 0.309017
10
Model2Yt = 1Yt1 0.25Yt2 + t
# F matrix
(ar22F <- rbind(ar22, c(1, 0)))
## [,1] [,2]
## ar22 1 -0.25
## 1 0.00
# Eigen Values
(ar22r <- eigen(ar22F)$values)
## [1] 0.5 0.5
# Abs of eigen values
abs(ar22r)
## [1] 0.5 0.5
Model3Yt = 1.5Yt1 0.75Yt2 + t
# F matrix
(ar23F <- rbind(ar23, c(1, 0)))
## [,1] [,2]
## ar23 1.5 -0.75
## 1.0 0.00
# Eigen Values
(ar23r <- eigen(ar23F)$values)
## [1] 0.75+0.4330127i 0.75-0.4330127i
# Abs of eigen values
abs(ar23r)
## [1] 0.8660254 0.8660254
Model4Yt = 0.6Yt1 + 0.2Yt2 + t
# F matrix
(ar24F <- rbind(ar24, c(1, 0)))
## [,1] [,2]
## ar24 -0.6 0.2
## 1.0 0.0
# Eigen Values
(ar24r <- eigen(ar24F)$values)
## [1] -0.8385165 0.2385165
# Abs of eigen values
abs(ar24r)
## [1] 0.8385165 0.2385165
All the series we considered here are stationary since the eigen values as less than |1|.
11
3.2.2 IRF and ACF
As we have discussed already any co-variance stationary AR(P) process say (L)Yt = t can be written as
M A() process,i.e., Yt = (L)t . The coefficients in (L) = 1 + 1 L + 2 L2 + . . . are known as Impulse
response function. The nature of IRF (and ACF) is determined by the roots of (L). For an AR(2) process:
Yt Yt+j
j = = = c1 j1 + c2 j2
tj t
and
1 2
c1 = , c1 =
1 2 2 1
We can also express the impulse response in terms of AR coefficients. Consider: (L)Yt = (L)(L)t = t
Thus, (L)(L) = 1. Now the two polynomials (L)(L) and 1 (the latter of order 0) are identical if and
only if the coefficients of each power are identical.
For AR(2) process (1 1 L 2 L2 )(0 + 1 L + 2 L2 + ...) = 1 Matching powers of L yields:
0 = 1
1 1 0 = 0 1 = 1
2 0 1 1 + 2 = 0 2 = 2 + 21
...
We will consider each model separately and analyse its IRF and ACF
Model1:Yt = 0.5Yt1 + 0.25Yt2 + t Both the Eigen values of this model are real with 1 = 0.81 and
2 = 0.31:
ar21r
## [1] 0.809017 -0.309017
We have already derived the expression for IRF in terms of eigen values. Using that result we have
j = c1 j1 + c2 j2 . Since the prominent eigen value is positive and less than |1| we can expect the IRF to
decay towards zero as lag increases. The above expression for j th IRF can also be rearranged using the values
of c1 and c2 as follows:
j+1 j+1
j = 1 2
1 2
Similarly the ACF also can be expressed as a function of eigen values since the ACF of AR(2) is a second
order difference equation i.e j = 1 j1 + 2 j2 . In terms of eigen values:
j = A1 j1 + A2 j2
Expanding A1 and A2 we have
(1 22 )j+1 (1 21 )j+1
j = 1 2
, forj 0
(1 2 )(1 + 1 2 )
Like IRF . ACF also decays towards zero. I hope the following graphs makes these points clear.
12
grid.arrange(acf.graph1(ar21, ma1, 15), pacf.graph1(ar21, ma1,
15), irf.graph1(ar21, ma1, 20), cirf.graph1(ar21, ma1, 20),
ncol = 2)
0.6 0.6
PACF
0.4 0.4
ACF
0.2 0.2
0.0 0.0
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
Shock 3
0.9 Accumulated IR
2
0.6
IR
1
0.3
0
0.0 1 5 9 13 17
1 5 9 13 17 Period after the shock
Model2:Yt = 1Yt1 0.25Yt2 + t This model has repeated real eigen values.
ar22r
## [1] 0.5 0.5
The root of the process is given as 2 .The
1
expressions of j and j for this process can be expressed as
follows.
j = (1 + j)j1
j
1 + 2
1
j = 1 + j , forj 0
1 2 2
Model two exhibits more or less similar structure compared to model1.
grid.arrange(acf.graph1(ar22, ma1, 15), pacf.graph1(ar22, ma1,
15), irf.graph1(ar22, ma1, 20), cirf.graph1(ar22, ma1, 20),
ncol = 2)
13
0.8
0.6
0.6
PACF
ACF
0.4 0.3
0.2 0.0
0.0
0.3
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
Shock 3
Accumulated IR
0.9
2
0.6
IR
1
0.3
0
0.0 1 5 9 13 17
1 5 9 13 17 Period after the shock
Model3:Yt = 1.5Yt1 0.75Yt2 + t Eigen Values of this process is complex and the IRF and ACF can
have cycles.
ar23r
## [1] 0.75+0.4330127i 0.75-0.4330127i
where the real part (a) is 0.75 and the imaginary part (bi) is $0.43i. The expression for IRF in this case is
j = 2Rj .cos(j) 2Rj sin(j)
Where R is the amplitude (distance from line to the peak (or to the trough) of the cycle),R = (a2 + b2 ):
p
R <- abs(ar23r)
(R <- R[1])
## [1] 0.8660254
a <- Re(ar23r)[1]
b <- Im(ar23r)[1]
cos() = a
R = 1
2 (2 )
(cos_theta <- a/R)
## [1] 0.8660254
Now the can be easily computed as follows
14
(theta1 <- acos(a/R))
## [1] 0.5235988
Using this the period of cycles (from one peak to another peak) can be computed as follows:
(period_cy <- (2 * pi)/theta1)
## [1] 12
You may verify this in the graphs below. The above expression for j can also be written as
sin ((j + 1))
j = Rj
sin()
and ACF is given as
sin(j + )
j = R j
sin()
can be obtained from tan() = 12
1+2
grid.arrange(acf.graph1(ar23, ma1, 15), pacf.graph1(ar23, ma1,
15), irf.graph1(ar23, ma1, 20), cirf.graph1(ar23, ma1, 20),
ncol = 2)
0.5
0.5
PACF
ACF
0.0
0.0
0.5
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
1.5
4
Accumulated IR
Shock
1.0
3
0.5
IR
0.0 1
0
0.5
1 5 9 13 17
1 5 9 13 17 Period after the shock
Model4:Yt = 0.6Yt1 + 0.2Yt2 + t Prominent eigen value of this series is negative and hence the ACF
and IRF will oscillate. Eigen values are real and the expressions given for Model1 can be used to compute
ACF and IRF.
15
ar23r
## [1] 0.75+0.4330127i 0.75-0.4330127i
grid.arrange(acf.graph1(ar24, ma1, 15), pacf.graph1(ar24, ma1,
15), irf.graph1(ar24, ma1, 20), cirf.graph1(ar24, ma1, 20),
ncol = 2)
0.4 0.00
PACF
ACF
0.0 0.25
0.4 0.50
0.8 0.75
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
Shock 0.0
1.0
Accumulated IR
0.2
0.5
IR
0.4
0.0
0.6
0.5
1 5 9 13 17
1 5 9 13 17 Period after the shock
This can be easily generalized to higher order AR process.
4 ARMA Process
An ARMA model is simulated as follows: Yt = 0.6Yt1 + 0.2Yt2 1.20t1 + 0.25t2 + t
The invertibility of ARMA process depends on roots of MA lag polynomial and stationarity on AR lag
polynomial. I am using the AR and MA coefficients that we used to simulate AR and MA process earlier.
You may cross check.
set.seed(123)
ma11.1 <- ma22 # define the MA coefficients
ar11.1 <- ar24 # define the AR coefficient
mu <- 0
model1 <- list(ma = ma11.1, ar = ar11.1)
s11.1 <- mu + arima.sim(model = model1, n = 250)
grid.arrange(ts.graph1(s11.1), irf.graph1(ar11.1, ma11.1, 20),
16
acf.graph1(ar11.1, ma11.1, 15), pacf.graph1(ar11.1, ma11.1,
15), ncol = 2)
4 1 Shock
0 0
IR
4
1
0 50 100 150 200 250
Periods 1 5 9 13 17
0.00
0.5
0.25
PACF
ACF
0.0
0.50
0.5
0.75
1.0
1 5 9 13 1 5 9 13
Period(lags) Period(lags)
PACF of an ARMA(p,q) process will behave like a PACF of MA(q) process after lag q, and ACF like AR(p)
process after lag p.
5 Assignments and Homework
1. Evaluate the mean, and covariance function for each of the following process. In each case determine
whether or not the process is stationary given t GW N (0, 2 )
(a) Yt = 0 + 1 t + t
(b) Xt = Yt (Yt is from part a above )
(c) Zt = 0 + tt
(d) Wt = Zt (Zt is from part c above )
(e) V3t = t t1
2. Which of the following process are covariance stationary? Compute the roots of Lag operators and verify
that it is the inverse of the eigenvalues of F matrix. The innovations are defined as t GW N (0, 1).
(a) Yt = 3 0.30Yt1 + 0.04Yt2 + t
(b) Yt = 5 + 3.10Yt1 0.03Yt2 + t
(c) Yt = 5 + 0.5Yt1 0.8Yt2 + t
17
3. Is the following MA(2) processes invertible
(a) Yt = 1 + 2.4t1 + 0.8t2 + t
(b) Yt = 5 .9t1 0.18t2 + t
(c) Yt = 0.5t1 0.4t2 + t
4. Compute the first three j , jj and j for the stationary /invertible process given in question 2 and 3
5. Generate simulated data for the stationary /invertible process given in question 2 and 3. Plots its ACF
and IRF.
6. Given (1 1 L 2 L2 )Yt = t , show that for a covariance stationary process 1 + 2 < 1, 2 1 < 1
and |2 | < 1 if roots are real. Also show that for a covariance stationary process 1 < |2|.
18