Week4 1
Week4 1
where ωt ∼ N (0, σ 2 )
• φ = (φ1 , φ2 , . . . , φp ) is the vector of model coefficients and
p is a non-negative integer.
• The AR model establishes that a realization at time t is a
linear combination of the p previous realization plus some
noise term.
• For p = 0, Xt = ωt and there is no autoregression term.
53
• The lag operator is denoted by B and used to express
lagged values of the process so BXt = Xt−1 ,
B 2 Xt = Xt−2 , B 3 Xt = Xt−3 ,. . ., B d Xt−d .
• If we define
p
X
Φ(B) = 1 − φj B j = 1 − φ 1 B − φ 2 B 2 − . . . − φ p B p
j=1
54
defined as
q
X
Xt = ω t + θj ωt−j
j=1
55
• The ARMA process of orders p and q is defined as
p
X q
X
Xt = φj Xt−j + θj ωt−j + ωt
j=1 j=1
56
polynomial) then β1 = 1/α1 , β2 = 1/α2 , . . . , βp = 1/αp
57
• For the complex case, we will use the representation
αi = ri exp(±ωi i), i = 1, . . . , C
αi = ri , i = 1, 2, . . . R
58
β = 1/φ (assuming φ 6= 0).
• The AR(1) process is stationary if only if |φ| < 1 or
−1 < φ < 1.
• The case where φ = 1 corresponds to a Random Walk
process with a zero drift, Xt = Xt−1 + ωt
• This is a non-stationary explosive process.
• If we recursive apply the AR(1) equation, the Random
Walk process can be expressed as
Xt = ωt + ωt−1 + ωt−2 + . . .. Then,
P∞ 2
V ar(Xt ) = t=0 σ = ∞.
• Example. AR(2) process Xt = φ1 Xt−1 + φ2 Xt−2 + ωt
• The characteristic polynomial is now
59
Φ(B) = (1 − φ1 B − φ2 B 2 )
• The solutions to Φ(B) = 0 are
q q
−φ1 + φ21 + 4φ2 −φ1 − φ21 + 4φ2
β1 = ; β2 =
2φ2 2φ2
• The reciprocal roots are
q q
φ1 + φ21 + 4φ2 φ1 − φ21 + 4φ2
α1 = ; α2 =
2 2
• The AR(2) is stationary if and only if ||α1 || < 1 and
||α2 || < 1
• These two conditions imply that ||α1 α2 || = |φ2 | < 1 and
||α1 + α2 || = |φ1 | < 2 which means −1 < φ2 < 1 and
−2 < φ1 < 2.
60
• For α1 and α2 real numbers, φ21 + 4φ2 ≥ 0 which implies
−1 < α2 ≤ α1 < 1 and after some algebra φ1 + φ2 < 1;
φ2 − φ1 < 1
φ21
• In the complex case φ21 + 4φ2 < 0 or −4 > φ2
• If we combine all the inequalities we obtain a region
bounded by the lines φ2 = 1 + φ1 ; φ2 = 1 − φ1 ; φ2 = −1.
• This is the region where the AR(2) process is stationary.
• For an AR(p) where p ≥ 3, the region where the process
is stationary is quite abstract.
• For the stationarity condition of the MA(q) process, we
need to rely on the general linear process.
• A general linear process is a random sequence Xt of the
61
form,
∞
X
Xt = aj ωt−j
j=0
62
∞
X
= σ2 aj aj+s−t ; (s ≥ t)
j=0
|γk | ≤ γ0
P∞
so if γ0 < ∞ then j=0 aj aj+k < ∞.
P∞ 2
• Then Xt is stationary if and only if j=0 j < ∞
a
• The MA(q) process can be written as a general linear
63
P∞
process of the form Xt = j=0 aj ωt−j where
θj j=0,. . . ,q
aj =
0 j=q+1,q+2,. . .
with θ0 = 1.
2 Pq
= j=0 θj2 < ∞ so a
P∞
• For the MA(q) process j=0 aj
moving average process is always stationary.
• For the ARMA(p,q) process given by Φ(B)Xt = Θ(B)ωt
Xt is stationary if only if the roots of Φ(B) = 0 have all
modulus greater than 1 or all the reciprocal roots have a
modulus less than one.
• A related concept to stationary linear process is
invertible process.
64
• Definition: A process Xt is invertible if
∞
X
Xt = aj Xt−j + ωt
j=1
P∞ 2
with the restriction that j=1 aj <∞
65
• The MA(q) process is invertible if and only if the roots of
Θ(B) have all modulus greater than one.
• To illustrate this last point consider the MA(1) process
Xt = (1 − θB)ωt
• If |θ| < 1 then
∞
1 X
Θ(B)−1 = = θj B j
(1 − θB) j=0
66
part of the process is invertible, i.e. when Θ(B) has
reciprocal roots with modulus less than one.
67
• The coefficients φk1 , φk2 , . . . , φkk define the PACF.
68
• The partial autocorrelation can be derived as follows.
Suppose that Zt is zero mean stationary process.
69
• If we divide by γ0 we get,
70
1 ρ1
ρ1 ρ2
φ22 =
1 ρ1
ρ1 ρ1
1 ρ1 ρ1
ρ1 1 ρ2
ρ2 ρ1 ρ3
φ33 =
1 ρ1 ρ2
ρ1 1 ρ1
ρ2 ρ1 1
71
1 ρ1 ρ2 . . . ρk−2 ρ1
ρ1 1 ρ1 ... ρk−3 ρ2
.. .. .. .. .. ..
. . . . . .
ρk−1 ρk−2 ρk−3 . . . ρ1 ρk
φkk =
1 ρ1 ρ2 . . . ρk−2 ρk−1
ρ1 1 ρ1 ... ρk−3 ρk−2
.. .. .. .. .. ..
. . . . . .
ρk−1 ρk−2 ρk−3 . . . ρ1 1
72
• Example. Consider the stationary AR(1) process ,
Xt = αXt−1 + ωt with −1 < α < 1. (change φ to α)
• Also
1 α
α α2
φ22 = =0
1 α
α 1
73
• The result is that for the AR(1)
α k=1
φkk =
0 k≥2
74
alpha=.9
xt=arima.sim(1000,model=list(ar=alpha))
par(mfrow=c(3,1),oma=c(2,2,2,2))
ts.plot(ts(xt))
acf(xt,lag=20)
acf(xt,type="partial",lag=20)
mtext("AR(1) process with alpha =.9,
sigma^2=1",outer=T,cex=1.1)
75
AR(1) process with alpha =.9, sigma^2=1
6
4
2
ts(xt)
−2 0
−6
Time
Series xt
0.8
ACF
0.4
0.0
0 5 10 15 20
Lag
Series xt
0.8
Partial ACF
0.4
0.0
5 10 15 20
Lag
76
# Now with a variance different to one
epsilon=rnorm(500,mean=0,sd=sqrt(3))
alpha=-.5
xt=arima.sim(500,model=list(ar=alpha),innov=epsilon)
par(mfrow=c(3,1),oma=c(2,2,2,2))
ts.plot(ts(xt))
acf(xt,lag=50)
acf(xt,type="partial",lag=50)
mtext("AR(1) process with alpha=-.5,
sigma^2=3",outer=T,cex=1.1)
77
AR(1) process with alpha=−.5, sigma^2=3
6
4
2
ts(xt)
0
−4
Time
Series xt
1.0
0.5
ACF
0.0
−0.5
0 10 20 30 40 50
Lag
Series xt
0.1
−0.1
Partial ACF
−0.3
−0.5
0 10 20 30 40 50
Lag
78
• Example. The AR(2) model
Xt = φ1 Xt−1 + φ2 Xt−2 + ωt
γk = φ1 γk−1 + φ2 γk−2 , k = 1, 2, . . .
• Dividing by γ0 gives,
ρk = φ1 ρk−1 + φ2 ρk−2 , k = 1, 2, . . .
79
• For this type of equations, it is recommended (Diggle) to
explore a solution of the form ρk = λk and try to
determine the value of λ.
• If we substitute λk in the difference equation, we get
λk = φ1 λk−1 + φ2 λk−2
λ2 − φ 1 λ − φ 2 = 0
80
the characteristic polynomial.
• Since α1 and α2 are solutions of the equation, then a
linear combination is also a solution.
• Then, the general solution to the difference equation
takes the form,
ρk = aα1k + bα2k , k = 0, 1, 2, . . .
ρ0 = 1 = a + b
81
ρ1 = φ1 /(1 − φ2 ) = aα1 + bα2
82
Φ(B) = (1 − re−iω B)(1 − reiω B) = (1 − 2rcos(ω)B + r 2 B 2 )
83
r=0.95
w=2*pi/15
phi1=2*r*cos(w)
phi2=-r^2
xt=arima.sim(500,model=list(ar=c(phi1,phi2)))
par(mfrow=c(3,1),oma=c(2,2,2,2))
ts.plot(as.ts(xt))
acf(xt,lag=50)
acf(xt,lag=50,type="partial")
84
AR(2) process with Phi1= 1.74 and Ph2= −0.9
15
as.ts(xt)
5
−5
−15
Time
Series xt
1.0
0.5
ACF
0.0
−0.5
0 10 20 30 40 50
Lag
Series xt
0.5
Partial ACF
0.0
−0.5
0 10 20 30 40 50
Lag
85
AR(2) process with Phi1= 1.37 and Ph2= −0.56
0 2 4 6
as.ts(xt)
−4
−8
Time
Series xt
1.0
0.6
ACF
0.2
−0.2
0 10 20 30 40 50
Lag
Series xt
0.8
Partial ACF
0.4
0.0
−0.6
0 10 20 30 40 50
Lag
86
• For the case of an AR(2) with two real roots r1 and r2 ,
the characteristic polynomial is
Φ(B) = (1 − r1 B)(1 − r2 B) = (1 − (r1 + r2 )B + r1 r2 B 2 )
r1=0.9
r2=0.5
phi1=r1+r2
phi2=-r1*r2
xt=arima.sim(500,model=list(ar=c(phi1,phi2)))
87
AR(2) process with Phi1= 1.4 and Ph2= −0.45
10
5
ts(xt)
0
−10
Time
Series xt
1.0
0.6
ACF
0.2
−0.2
0 10 20 30 40 50
Lag
Series xt
1.0
Partial ACF
0.5
0.0
−0.5
0 10 20 30 40 50
Lag
88
AR(2) process with Phi1= −1.4 and Ph2= −0.45
5 10
ts(xt)
−5 0
−15
Time
Series xt
1.0
0.5
ACF
0.0
−1.0
0 10 20 30 40 50
Lag
Series xt
−0.2
Partial ACF
−0.6
−1.0
0 10 20 30 40 50
Lag
89