Week 2 Slides White Background
Week 2 Slides White Background
representation
Practical Time Series Analysis
Thistleton and Sadigov
Objectives
• Recall infinite series and their convergence
• Examine geometric series
• Represent rational functions as a geometric series
Sequence and series
• Sequence 𝑎𝑛 is list of numbers in definite order
𝑎1 , 𝑎2 , 𝑎3 , … 𝑎𝑛 , …
• If the limit of the sequence exists, i..e,
lim 𝑎𝑛 = 𝑎
𝑛→∞
then we say the sequence is convergent.
Examples
𝑛
• 𝑎𝑛 =
𝑛+1
1 2 3 𝑛
, , ,…, ,… → 1
2 3 4 𝑛+1
• 𝑎𝑛 = 3𝑛
3, 9, 27, … , 3𝑛 , …
• 𝑎𝑛 = 𝑛
1, 2, 3, … , 𝑛, …
1
• 𝑎𝑛 =
𝑛2
1 1 1
1, , , … , 2 , … → 0
4 9 𝑛
Partial sums
• Partial sums of a sequence 𝑎𝑛 are defined as
𝑠𝑛 = 𝑎1 + 𝑎2 + ⋯ + 𝑎𝑛
• 𝑠1 = 𝑎1
• 𝑠2 = 𝑎1 + 𝑎2
• 𝑠3 = 𝑎1 + 𝑎2 + 𝑎3
.
.
.
Series
• If the partial sums 𝑠𝑛 is convergent to a number s, then we
say
∞
the infinite series 𝑘=1 𝑎𝑘 is convergent, and is equal to s.
∞
∞
• Otherwise, we say 𝑘=1 𝑎𝑘 is divergent.
Some convergent series
∞ 1
• 𝑘=1 2𝑘 =1
∞ 1 𝜋2
• 𝑘=1 𝑘 2 =
6
∞ −1 𝑘+1
• 𝑘=1 = ln 2
𝑘
Some divergent series
∞ 𝑘
• 𝑘=1 3
∞
• 𝑘=1(2𝑘 + 1)
∞ 1
• 𝑘=1 𝑘
Absolute convergence
• Series is absolutely convergent if
∞
|𝑎𝑘 |
𝑘=1
is convergent.
• Geometric series
∞ 𝑘−1 𝑎
𝑘=1 𝑎𝑟 =
1−𝑟
if 𝑟 < 1.
1
∞ 1 1 1 1 2
• 𝑘=1 2𝑘 = + + +⋯= 1 =1
2 4 8 1−
2
1 1
since 𝑎 = , 𝑟 = .
2 2
Series representation
1
• Series representation for
1−𝑥
where 𝑎 = 1, 𝑟 = 𝑥.
1
= 1 + 𝑥 + 𝑥2 + 𝑥3 + ⋯
1−𝑥
if 𝑥 < 1.
Series representation cont.
1
• Series representation for 𝑥
1−𝑥 1−2
∞
1 2 −1 1 𝑘
𝑥 = + 𝑥 = 2 − 𝑘
𝑥
1−𝑥 1− 1 − 𝑥 1− 2
2 2 𝑘=0
𝑥
If 𝑥 < 1 and < 1, i.e., if 𝑥 < 1.
2
Complex functions
Assume z is a complex number
𝑎 ∞
= 𝑎 + 𝑎𝑧 + 𝑎𝑧 2 + ⋯ = 𝑘=1 𝑎𝑧 𝑘−1
1−𝑧
if |z| < 1.
What We’ve Learned
𝐵𝑋𝑡 = 𝑋𝑡−1
𝑋𝑡 = 𝐵𝑋𝑡 + 𝑍𝑡
1 − 𝐵 𝑋𝑡 = 𝑍𝑡
𝜙 𝐵 𝑋𝑡 = 𝑍𝑡
where
𝜙 𝐵 =1−𝐵
Example – MA(2) process
𝑋𝑡 = 𝑍𝑡 + 0.2𝑍𝑡−1 + 0.04𝑍𝑡−2
𝑋𝑡 = 𝑍𝑡 + 0.2𝐵𝑍𝑡 + 0.04𝐵2 𝑍𝑡
𝑋𝑡 = (1 + 0.2𝐵 + 0.04𝐵2 ) 𝑍𝑡
𝑋𝑡 = 𝛽 𝐵 𝑍𝑡
where
𝛽 𝐵 = 1 + 0.2𝐵 + 0.04𝐵2
Example – AR(2) process
𝑋𝑡 = 0.2𝑋𝑡−1 + 0.3𝑋𝑡−2 + 𝑍𝑡
𝑋𝑡 = 0.2𝐵𝑋𝑡 + 0.3𝐵2 𝑋𝑡 + 𝑍𝑡
𝜙(𝐵)𝑋𝑡 = 𝑍𝑡
where
𝜙 𝐵 = 1 − 0.2𝐵 − 0.3𝐵2
MA(q) process (with a drift)
𝑋𝑡 = 𝜇 + 𝛽0 𝑍𝑡 + 𝛽1 𝑍𝑡−1 + ⋯ + 𝛽𝑞 𝑍𝑡−𝑞 ,
Then,
𝑋𝑡 = 𝜇 + 𝛽0 𝑍𝑡 + 𝛽1 𝐵1 𝑍𝑡 + ⋯ + 𝛽𝑞 𝐵𝑞 𝑍𝑡 ,
𝑋𝑡 − 𝜇 = 𝛽 𝐵 𝑍𝑡 ,
where
𝛽 𝐵 = 𝛽0 + 𝛽1 𝐵 + ⋯ + 𝛽𝑞 𝐵𝑞 .
AR(p) process
Then,
𝑋𝑡 − 𝜙1 𝑋𝑡−1 − 𝜙2 𝑋𝑡−2 − ⋯ − 𝜙𝑝 𝑋𝑡−𝑝 = 𝑍𝑡
𝑋𝑡 − 𝜙1 𝐵𝑋𝑡 − 𝜙2 𝐵2 𝑋𝑡 − ⋯ − 𝜙𝑝 𝐵𝑝 𝑋𝑡 = 𝑍𝑡
𝜙 𝐵 𝑋𝑡 = 𝑍𝑡 ,
Where
𝜙 𝐵 = 1 − 𝜙1 𝐵 − 𝜙2 𝐵2 − ⋯ − 𝜙𝑝 𝐵𝑝 .
What We’ve Learned
• The definition of the Backward shift operator
𝑋𝑡 = 𝑍𝑡 + 2𝑍𝑡−1
• Model 2
1
𝑋𝑡 = 𝑍𝑡 + 𝑍𝑡−1
2
Theoretical Auto Covariance Function of
Model 1
𝛾 𝑘 = 𝐶𝑜𝑣 𝑋𝑡+𝑘 , 𝑋𝑡 = 𝐶𝑜𝑣 𝑍𝑡+𝑘 + 2𝑍𝑡+𝑘−1 , 𝑍𝑡 + 2𝑍𝑡−1
If 𝑘 = 0, then
𝛾 0 = 𝐶𝑜𝑣 𝑍𝑡 + 2𝑍𝑡−1 , 𝑍𝑡 + 2𝑍𝑡−1 =
If 𝑘 < 0, then
𝛾 𝑘 = 𝛾(−𝑘)
Auto Covariance Function and ACF of Model 1
0, 𝑘>1
2𝜎𝑍2 , 𝑘=1
𝛾 𝑘 =
5𝜎𝑍2 , 𝑘=0
𝛾 −𝑘 , 𝑘<0
𝛾 𝑘
Then, since 𝜌 𝑘 = ,
𝛾 0
0, 𝑘>1
2
, 𝑘=1
𝜌 𝑘 = 5
1, 𝑘=0
𝜌 −𝑘 , 𝑘<0
ACF
ACF of Model 2
1 1 1
𝛾 1 𝐶𝑜𝑣 𝑍𝑡+1 + 𝑍𝑡 , 𝑍𝑡 + 𝑍𝑡−1 2
𝜌 1 = = 2 2 = 2 = .
𝛾 0 1 1 1 5
𝐶𝑜𝑣[𝑍𝑡 + 𝑍𝑡−1 , 𝑍𝑡 + 𝑍𝑡−1 ] 1 +
2 2 4
0, 𝑘>1
2
, 𝑘=1
𝜌 𝑘 = 5
1, 𝑘=0
𝜌 −𝑘 , 𝑘<0
ACFs are same!
Inverting through backward substitution
MA(1) process
𝑋𝑡 = 𝑍𝑡 + 𝛽𝑍𝑡−1 ,
In this manner,
i.e.,
𝑋𝑡 = 𝑍𝑡 + 𝛽𝑋𝑡−1 − 𝛽 2 𝑋𝑡−2 + 𝛽 3 𝑋𝑡−3 − ⋯
𝑋𝑡 = 𝛽 𝐵 𝑍𝑡
where
𝛽 𝐵 = 1 + 𝛽𝐵
𝛽 𝐵 −1 𝑋 = 𝑍𝑡
𝑡
Inverse of 𝛽(𝐵)
−1
1
𝛽 𝐵 = = 1 − 𝛽𝐵 + 𝛽2 𝐵2 − 𝛽3 𝐵3 + ⋯
1 + 𝛽𝐵
Thus we obtain,
−1
𝛽 𝐵 𝑋𝑡 = 1 − 𝛽𝑋𝑡−1 + 𝛽2 𝑋𝑡−2 − 𝛽3 𝑋𝑡−3 + ⋯
∞
𝑍𝑡 = −𝛽 𝑛 𝑋𝑡−𝑛
𝑛=0
𝑋𝑡 is a stochastic process.
∞
𝑋𝑡 is called invertible, if 𝑍𝑡 = 𝑘=0 𝜋𝑘 𝑋𝑡−𝑘 where
∞
𝑘=0 𝜋𝑘 is convergent.
Model 1 vs Model 2
• Model 1 is not invertible since
∞ ∞
|𝜋𝑘 | = 2𝑘 , 𝐷𝑖𝑣𝑒𝑟𝑔𝑒𝑛𝑡
𝑘=0 𝑘=0
𝑋𝑡 = 𝛽0 𝑍𝑡 + 𝛽1 𝑍𝑡−1 + ⋯ 𝛽𝑞 𝑍𝑡−𝑞
𝑋𝑡 = 𝛽0 + 𝛽1 𝐵 + ⋯ + 𝛽𝑞 𝐵𝑞 𝑍𝑡 = 𝛽 𝐵 𝑍𝑡
For this to hold, “complex roots of the polynomial 𝛽(𝐵) must lie
outside of the unit circle where 𝐵 is regarded as complex variable”.
Invertibility condition for MA(q)
MA(q) process is invertible if the roots of the polynomial
𝛽 𝐵 = 𝛽0 + 𝛽1 𝐵 + ⋯ + 𝛽𝑞 𝐵𝑞
• 𝛽 𝐵 = 1 + 𝛽𝐵
1
• In this case only one (real) root 𝐵 = −
𝛽
1
• − > 1 ⇒ 𝛽 < 1.
𝛽
∞ 𝑘 𝐵𝑘 ∞ 𝑘𝑋
• Then, 𝑍𝑡 = 𝑘=0 (−𝛽) 𝑋𝑡 = 𝑘=0 (−𝛽) 𝑡−𝑘
Example – MA(2) process
5 1
𝑋𝑡 = 𝑍𝑡 + 𝑍𝑡−1 + 𝑍𝑡−2
6 6
Then,
𝑋𝑡 = 𝛽 𝐵 𝑍𝑡
Where
5 1 2
𝛽 𝐵 =1+ 𝐵+ 𝐵
6 6
Example cont.
5 1 2
1+ 𝑧+ 𝑧 =0
6 6
𝑧1 = 2, 𝑧2 = 3
Example cont.
−1 1 3 2
𝛽 𝐵 = 5 1 = 1 − 1
1+ 𝐵+ 𝐵2 1+ 𝐵
2
1+ 𝐵
3
6 6
∞ 𝑘 𝑘
−1
1 1
𝛽 𝐵 = 3 − −2 − 𝐵𝑘
2 3
𝑘=0
∞ 𝑘 𝑘
1 1
𝑍𝑡 = 3 − −2 − 𝐵𝑘 𝑋𝑡
2 3
𝑘=0
∞ ∞
𝑍𝑡 = 𝜋𝑘 𝐵𝑘 𝑋𝑡 = 𝜋𝑘 𝑋𝑡−𝑘
𝑘=1 𝑘=1
Where
𝑘 𝑘
1 1
𝜋𝑘 = 3 − −2 −
2 3
MA(2) process ⟹ AR(∞) process
Stationarity condition for AR(p)
AR(p) process
𝑋𝑡 = 𝜙1 𝑋𝑡−1 + 𝜙2 𝑋𝑡−2 + ⋯ + 𝜙𝑝 𝑋𝑡−𝑝 + 𝑍𝑡
𝜙 𝐵 = 1 − 𝜙1 𝐵 − 𝜙2 𝐵2 − ⋯ − 𝜙𝑝 𝐵𝑝 .
𝜙 𝐵 = 1 − 𝜙1 𝐵
1
𝜙 𝑧 = 1 − 𝜙1 𝑧 = 0 ⟹ 𝑧 =
𝜙1
1
𝑧 = > 1 ⇒ 𝜙1 < 1
𝜙1
Thus, when 𝜙1 < 1, the AR(1) process is stationary.
1
𝑋𝑡 = 𝑍𝑡 = 1 + 𝜙1 𝐵 + 𝜙1 𝐵2 − ⋯ 𝑍𝑡
∞
1 − 𝜙1 𝐵
= 𝜙1𝑘 𝑍𝑡−𝑘
𝑘=0
Another look at 𝜙1
Take Variance from both side,
∞ ∞ ∞
𝜙1 < 1.
AR(𝑝) process ⟹ MA(∞) process
Duality between AR and MA processes
MA(q) ⟹ AR(∞)
AR(p) ⟹ MA(∞)
What We’ve Learned
2
𝐸 𝑋𝑛 − 𝑋 → 0 𝑎𝑠 𝑛 → ∞
MA(1) model
We inverted MA(1) model
𝑋𝑡 = 𝑍𝑡 + 𝛽𝑍𝑡−1
as
∞
𝑍𝑡 = −𝛽 𝑘 𝑋𝑡−𝑘
𝑘=0
0, 𝑘>1
𝛽𝜎𝑍2 , 𝑘=1
𝛾 𝑘 =
(1 + 𝛽2 )𝜎𝑍2 , 𝑘=0
𝛾 −𝑘 , 𝑘<0
Series convergence
Lets find 𝛽′ 𝑠 that partial sum
−𝛽 𝑘 𝑋𝑡−𝑘
𝑘=0
𝑛
𝐸 𝑘=0 −𝛽 𝑘 𝑋𝑡−𝑘 −
i.e.,
1
− >1
𝛽
𝛽 𝐵 = 1 + 𝛽𝐵
3, 5, 7, …
𝑎𝑛 = 5𝑎𝑛−1 − 6𝑎𝑛−2
𝑎𝑛 = 𝜆𝑛
𝜆𝑛 = 5𝜆𝑛−1 − 6𝜆𝑛−2
We simplify
𝜆2 − 5𝜆 + 6 = 0
We get
𝑐1 + 𝑐2 = 3
2𝑐1 + 3𝑐2 = 8
Thus,
𝑐1 = 1, 𝑐2 = 2.
Solution
𝑎𝑛 = 2𝑛 + 2 ∙ 3𝑛
𝑎𝑛 = 5𝑎𝑛−1 − 6𝑎𝑛−2
𝑘-th order difference equation
𝑎𝑛 = 𝛽1 𝑎𝑛−1 + 𝛽2 𝑎𝑛−2 + ⋯ + 𝛽𝑘 𝑎𝑛−𝑘
𝜆𝑘 − 𝛽1 𝜆𝑘−1 − ⋯ − 𝛽𝑘−1 𝜆 − 𝛽𝑘 = 0
1, 1, 2, 3, 5, 8, 13, 21, …
i.e., every term starting from the 3rd term is addition of the
previous two terms.
𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2
where 𝑎0 = 1, 𝑎1 = 1.
𝜆2 − 𝜆 − 1 = 0
1− 5 1+ 5
Then 𝜆1 = and 𝜆2 = .
2 2
Thus
𝑛 𝑛
1− 5 1+ 5
𝑎𝑛 = 𝑐1 + 𝑐2
2 2
𝑐1 + 𝑐2 = 1
1− 5 1+ 5
𝑐1 + 𝑐2 =1
2 2
General term of Fibonacci sequence
We obtain
5− 5 1 1− 5
𝑐1 = =−
10 5 2
5+ 5 1 1+ 5
𝑐2 = =
10 5 2
𝑛+1 𝑛+1
1 1− 5 1 1+ 5
𝑎𝑛 = − +
Relation to differential equations
𝑘 −th order linear ordinary equation
𝑦 𝑘 = 𝛽1 𝑦 𝑘−1 + ⋯ 𝛽𝑘−1 𝑦 + 𝛽𝑘
𝜆𝑘 − 𝛽1 𝜆𝑘−1 − ⋯ − 𝛽𝑘−1 𝜆 − 𝛽𝑘 = 0
Polynomial
1 1 2
𝜙 𝐵 =1− 𝐵− 𝐵
3 2
−2 ± 76
has real roots both of which has magnitude greater than 1, so
6
roots are outside of the unit circle in ℝ2 . Thus, this AR(2) process is a
stationary process.
Example cont.
Note that if 𝐸 𝑋𝑡 = 𝜇, then
1 1
𝐸(𝑋𝑡 ) = 𝐸(𝑋𝑡−1 ) + 𝐸(𝑋𝑡−2 ) + 𝐸(𝑍𝑡 )
3 2
1 1
𝜇= 𝜇+ 𝜇
3 2
𝜇=0
Multiply both side of ∗ with 𝑋𝑡−𝑘 , and take expectation
1 1
𝐸 𝑋𝑡−𝑘 𝑋𝑡 = 𝐸 𝑋𝑡−𝑘 𝑋𝑡−1 + 𝐸 𝑋𝑡−𝑘 𝑋𝑡−2 + 𝐸(𝑋𝑡−𝑘 𝑍𝑡 )
3 2
Example cont.
Since 𝜇 = 0, and assume 𝐸 𝑋𝑡−𝑘 𝑍𝑡 = 0,
1 1
𝛾 −𝑘 = 𝛾 −𝑘 + 1 + 𝛾(−𝑘 + 2)
3 2
Since 𝛾 𝑘 = 𝛾 −𝑘 for any 𝑘,
1 1
𝛾 𝑘 = 𝛾 𝑘 − 1 + 𝛾(𝑘 − 2)
3 2
Divide by 𝛾 0 = 𝜎𝑋2
1 1
𝜌 𝑘 = 𝜌 𝑘 − 1 + 𝜌(𝑘 − 2)
3 2
2
1 1
𝜆 − 𝜆− =0
3 2
2+ 76 2− 76
Roots are 𝜆1 = and 𝜆2 = , thus
12 12
𝑘 𝑘
2 + 76 2 − 76
𝜌 𝑘 = 𝑐1 + 𝑐2
12 12
Finding 𝑐1 , 𝑐2
Use constraints to obtain coefficients
𝜌 0 = 1 ⇒ 𝑐1 + 𝑐2 = 1
And for 𝑘 = 𝑝 − 1 = 2 − 1 = 1,
𝜌 𝑘 = 𝜌 −𝑘
Thus,
1 1 2 2 + 76 2 − 76 2
𝜌 1 = 𝜌 0 + 𝜌 −1 ⇒ 𝜌 1 = ⇒ 𝑐1 + 𝑐2 =
3 2 3 12 12 3
Solve the system for 𝑐1 , 𝑐2
𝑐1 + 𝑐2 = 1
2 + 76 2 − 76 2
𝑐1 + 𝑐2 =
12 12 3
Then,
4+ 6 4− 6
𝑐1 = and 𝑐2 =
8 8
ACF of the AR(2) model
For any 𝑘 ≥ 0,
𝑘 𝑘
4 + 6 2 + 76 4 − 6 2 − 76
𝜌 𝑘 = +
8 12 8 12
And
𝜌 𝑘 = 𝜌 −𝑘
Simulation
What We’ve Learned