Professional Documents
Culture Documents
Week 1 - Slides White
Week 1 - Slides White
Week 1 - Slides White
Analysis
PRACTICAL TIME SERIES ANALYSIS
THISTLETON AND SADIGOV
Objectives
jj
flu
globtemp
globtempl
star
Johnson and Johnson Quarterly Earnings
(jj)
i.e., No trend
No systematic change in variation
No periodic fluctuations
The properties of one section of a data are much
like the properties of the other sections of the
data
For an non-stationary time series, we will do
some transformations to get stationary time
series
What We’ve Learned
In a (weak) stationary time series, there is no
systematic change in mean (no trend)
systematic change in variance
periodic variations
Autocovariance function
PRACTICAL TIME SERIES ANALYSIS
THISTLETON AND SADIGOV
Objectives
recall random variables and covariance of two
random variables
characterize time series as a realization of a
stochastic process
define autocovariance function
Random variables
Random variable is defined
𝑋: 𝑆 → ℝ
where S is the sample space of the experiment.
From data to a model
{45,36,27,…} r.v. X
Discrete vs. Continuous r.v.
X= {20, 37, 57, …} VS. Y in (10, 60)
20 is a realization of r.v. X
30.29 is a realization of a r.v. Y
Covariance
X, Y are two random variables.
Measures the linear dependence between two random
variables
𝐶𝑜𝑉 𝑋, 𝑌 = 𝐸[ 𝑋 − 𝜇𝑋 𝑌 − 𝜇𝑌 ] = 𝐶𝑜𝑣(𝑌, 𝑋)
Stochastic Processes
Collection of a random variables
𝑋1 , 𝑋2 , 𝑋3 , …
2
𝑋𝑡 ~ 𝑑𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 (𝜇, 𝜎 )
Time series as a realization of a
stochastic process
𝑋1 , 𝑋2 , 𝑋3 , …
𝛾 𝑡, 𝑡 = 𝐸 𝑋𝑡 − 𝜇𝑡 2
= 𝑉𝑎𝑟 𝑋𝑡 = 𝜎𝑡2
Autocovariance function cont.
𝛾𝑘 = 𝛾 𝑡, 𝑡 + 𝑘 ≈ 𝑐𝑘
What We’ve Learned
the definition of a stochastic processes
how to characterize time series as realization of a
stochastic process
how to define autocovariance function of a time
series
Autocovariance coefficients
PRACTICAL TIME SERIES ANALYSIS
THISTLETON AND SADIGOV
Objectives
Recall the covariance coefficient for a bivariate data
set
Define autocovariance coefficients for a time series
Estimate autocovariance coefficients of a time series
at different lags
Covariance
𝑋, 𝑌 are two random variables.
Measures the linear dependence between two random
variables
𝑁
𝑡=1 𝑥𝑡 − 𝑥 𝑦𝑡 − 𝑦
𝑠𝑥𝑦 =
𝑁−1
Autocovariance coefficients
𝛾𝑘
−1 ≤ 𝜌𝑘 = ≤1
𝛾0
𝑁−𝑘
𝑡=1 𝑥𝑡 − 𝑥 𝑥𝑡+𝑘 − 𝑥
𝑟𝑘 = 𝑁 2
𝑥
𝑡=1 𝑡 − 𝑥
acf() routine
We have already used it for autocovariance
coefficients
It plots autocorrelation coefficients at
different lags: Correlogram
𝑐0
It always starts at 1 since 𝑟0 = =1
𝑐0
What We’ve Learned
Definition of the autocorrelation function (ACF)
How to produce correlograms using acf()
routine
How to estimate the autocorrelation
coefficients at different lags using acf()
routine.
Random Walk
Location at time t
𝑋𝑡 = 𝑋𝑡−1 + 𝑍𝑡 𝑍𝑡 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (𝜇, 𝜎 2 )
(or a price of a
stock today)
White noise
(residual)
𝑋0 = 0 𝑋1 = 𝑍1 𝑋2 = 𝑍1 + 𝑍2
𝑋𝑡 =
𝑖=1
𝑍𝑖
…
𝑡 𝑡
𝐸 𝑋𝑡 = 𝐸 𝑍𝑖 = 𝐸[𝑍𝑖 ] = 𝜇𝑡
𝑖=1 𝑖=1
𝑡 𝑡
2
𝑉𝑎𝑟 𝑋𝑡 = 𝑉𝑎𝑟 𝑍𝑖 = 𝑉𝑎𝑟[𝑍𝑖 ] = 𝜎 𝑡
𝑖=1 𝑖=1
𝑋1 Simulation
=0
𝑍𝑡 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (0, 1)
𝑋𝑡 = 𝑋𝑡−1 + 𝑍𝑡 for 𝑡 = 2,3, … , 1000
Plot and ACF
Removing the tend
𝑋𝑡 = 𝑋𝑡−1 + 𝑍𝑡 𝑋𝑡 − 𝑋𝑡−1 = 𝑍𝑡
𝛻𝑋𝑡 = 𝑋𝑡 − 𝑋𝑡−1
𝑍𝑡 …𝑍𝑡−𝑞
𝑋𝑡
𝑋𝑡 = 𝑍𝑡 + 𝜃1 𝑍𝑡−1 + 𝜃2 𝑍𝑡−2 +…+𝜃𝑞 𝑍𝑡−𝑞
2
𝑍𝑖 are i.id. & 𝑍𝑖 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (𝜇, 𝜎 )
What We’ve Learned
𝑍𝑡 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (0, 1)
What We’ve Learned