Professional Documents
Culture Documents
Introduction To Time Series Analysis
Introduction To Time Series Analysis
Series 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
characterizetime series as a realization of
a stochastic process
define autocovariance function
Random variables
𝑋: 𝑆 → ℝ
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.
20 is a realization of r.v. X
30.29 is a realization of a r.v. Y
Covariance
𝐶𝑜𝑉 𝑋, 𝑌 = 𝐸[ 𝑋 − 𝜇𝑋 𝑌 − 𝜇𝑌 ] = 𝐶𝑜𝑣(𝑌, 𝑋)
Stochastic Processes
𝑋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
𝑁
𝑡=1 𝑥𝑡 − 𝑥 𝑦𝑡 − 𝑦
𝑠𝑥𝑦 =
𝑁−1
Autocovariance coefficients
𝑁−𝑘
𝑡=1 𝑥𝑡 −𝑥 𝑥𝑡+𝑘 −𝑥
𝑐𝑘 =
𝑁
where
𝑁
𝑡=1 𝑥𝑡
𝑥=
𝑁
Routine in R
𝛾𝑘
−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
White noise
(residual)
𝑋0 = 0 𝑋1 = 𝑍1 𝑋2 = 𝑍1 + 𝑍2
𝑋𝑡 =
𝑖=1
𝑍𝑖
…
𝑡 𝑡
𝐸 𝑋𝑡 = 𝐸 𝑍𝑖 = 𝐸[𝑍𝑖 ] = 𝜇𝑡
𝑖=1 𝑖=1
𝑡 𝑡
𝑋𝑡 = 𝑋𝑡−1 + 𝑍𝑡 𝑋𝑡 − 𝑋𝑡−1 = 𝑍𝑡
𝛻𝑋𝑡 = 𝑋𝑡 − 𝑋𝑡−1
Each daily
𝑋𝑡 is a stock price of announcement of
a company the company is
modeled as a noise
Effect of the daily
announcements (noises 𝑍𝑡 )
on the stock price (𝑋𝑡 )
might last few days (say 2
days)
Stock price is linear
Moving average
combination of the
model of order 2
noises that affects it
MA(2)
𝑋𝑡 = 𝑍𝑡 + 𝜃1 𝑍𝑡−1 +𝜃2 𝑍𝑡−2
MA(q) model 𝑍𝑡−1
𝑍𝑡 …𝑍𝑡−𝑞
𝑋𝑡
𝑋𝑡 = 𝑍𝑡 + 𝜃1 𝑍𝑡−1 + 𝜃2 𝑍𝑡−2 +…+𝜃𝑞 𝑍𝑡−𝑞
𝑍𝑡 ~ 𝑁𝑜𝑟𝑚𝑎𝑙 (0, 1)
What We’ve Learned