Professional Documents
Culture Documents
Time Series Analysis: Andrea Beccarini
Time Series Analysis: Andrea Beccarini
Andrea Beccarini
Winter 2013/2014
Descriptive Statistics
Probability Theory
Statistical Inference
Class
Class teacher: Sarah Meyer
Time: Tu., 12:00-14:00
Location: CAWM 3
Start: 22 October 2013
Material
Course page on Blackboard
Slides and class material are (or will be) downloadable
Typical notations
x1 , x2 , . . . , xT
or x(1), x(2), . . . , x(T )
or xt , t = 1, . . . , T
or (xt )t0
This course is about . . .
univariate time series
in discrete time
with continuous states
600
GDP (in current billion Euro)
550
500
450
400
350
Time
2000
Time
9.0
logarithm of DAX
8.0
7.0
6.0
Time
Distinguish four cases: both time and chance can be fixed or variable
t fixed t variable
fixed Xt () is a Xt () is a sequence of
real number real numbers (path,
realization, trajectory)
variable Xt () is a Xt () is a stochastic
random variable process
process.R
t NID 0, 2
Xt = Xt1 + t and X0 = 0
2
t NID(0, )
Xt = Z
Z N(0, 2 )
(s, t)
(s, t) = p p
(s) 2 (t)
2
moments.R [1]
(t, s) = (t + r , s + r )
(h) = (t, t + h)
(h) = (t, t + h)
T 1
(0) 2 X h
Var () = + 1 (h)
T T T
h=1
N (, Var ())
and asymptotically
!
X
T ( ) Z N 0, (0) + 2 (h)
h=1
E ( (h)) = T 1 + O(T 2 )
1 2 )
T + O(T for h1 = h2
Cov ( (h1 ) , (h2 )) = 2
O T else
x2 + 1 = 0
Geometric interpretation:
seq(0, 8, length = 11)
imaginary axis
a+bi
er
alu
ev
lut
so imaginary part b
ab
real part a
real axis
z = a + bi
= r (cos + i sin )
= re i
a = r cos
b = r sin
p
r = a2 + b 2
b
= arctan
a
Rules of calculus:
Addition
(a + bi) + (c + di) = (a + c) + (b + d)i
Multiplication (cartesian coordinates)
r1 e i1 r2 e i2 = r1 r2 e i(1 +2 )
Addition:
seq(2, 8, length = 11)
imaginary axis
a+bi
c+di
real axis
Addition:
seq(2, 8, length = 11)
imaginary axis
a+bi
c+di
real axis
Addition:
(a+c)+(b+d)i
seq(2, 8, length = 11)
imaginary axis
a+bi
c+di
real axis
Multiplication:
seq(2, 8, length = 11)
imaginary axis
2
r1
r2
real axis
Multiplication:
r=
seq(2, 8, length = 11)
imaginary axis
r1
r
2
= 1 + 2
2
r1
r2
real axis
x 2 + px + q = 0
x 2 2x + 5 = 0
are r
(2) (2)2
x = + 5 = 1 + 2i
2 4
and r
(2) (2)2
x = 5 = 1 2i
2 4
xt = c + 1 xt1
xt = c + 1 xt1 + . . . + p xtp
xt = 1 xt1
is
xt = A t1
with arbitrary constant A since xt = At1 = 1 At1
1 = 1 xt1
The constant is definitized by the initial condition, A = x0
The sequence xt = At1 is convergent if and only if |1 | < 1
xt = 1 xt1 + . . . + p xtp
Let xt = Az t , then
Az t = 1 Az (t1) + . . . + p Az (tp)
z t = 1 z (t1) + . . . + p z (tp)
and thus
1 1 z 1 . . . p z p = 0
Characteristic polynomial, characteristic equation
xt = A1 z1t + . . . + Ap zpt
xt = 1 xt1 + . . . + p xtp
1 1 z . . . p z p = 0
are outside the unit circle, i.e. |zi | > 1 for all i = 1, . . . , p
In R, the stability condition can be checked easily using the
commands polyroot (base package) or ArmaRoots (fArma package)
Xt = 1 Xt1 + . . . + p Xtp + t + 1 t1 + . . . + q tq
Rules
L2 Xt = L (LXt ) = Xt2
n
L Xt = Xtn
1
L = Xt+1
0
L Xt = Xt
Lag polynomial
A(L) = a0 + a1 L + a2 L2 + . . . + ap Lp
C (L) = A(L)B(L)
= (1 0.5L) 1 + 4L2
(L) = 1 1 L . . . p Lp
(L) = 1 + 1 L + . . . + q Lq
(L)Xt = (L)t
MA(q) process : Xt = t + 1 t1 + . . . + q tq
AR(1) process : Xt = 1 Xt1 + t
AR(p) process : Xt = 1 Xt1 + + p Xtp + t
Xt = (L)t
Xt = t + 1 t1 + . . . + q tq
with t NID(0, 2 )
Expectation function
E (Xt ) = E (t + 1 t1 + . . . + q tq )
= E (t ) + 1 E (t1 ) + . . . + q E (tq )
= 0
Autocovariance function
(s, t)
= E (s + 1 s1 + . . . + q sq ) (t + 1 t1 + . . . + q tq )
= E s t + 1 s t1 + 2 s t2 + . . . + q s tq
+1 s1 t + 12 s1 t1 + 1 2 s1 t2 + . . . + 1 q s1 tq
+...
+q sq t + 1 q sq t1 + 2 q sq t2 + . . . + q2 sq tq
Define 0 = 1, then
Xq
(t, t) = 2 2
i=0 i
Xq1
(t 1, t) = 2 i i+1
i=0
Xq2
(t 2, t) = 2 i i+2
i=0
(t q, t) = 2 0 q = 2 q
(s, t) = 0 for s < t q
(L)Xt = t
(1 1 L)Xt = t
Xt = 1 Xt1 + t
with t NID(0, 2 )
Expectation and variance function [6]
E (X0 ) = 0
2
Var (X0 ) =
1 21
(L)Xt = t
Xt = 1 Xt1 + . . . + p Xtp + t
with t NID(0, 2 )
Assumption: t is independent from Xt1 , Xt2 , . . . (innovations)
Expectation function [10]
(z) = 0
Xt = 1 Xt1 + t
= 1 (1 Xt2 + t1 ) + t
= 21 Xt2 + 1 t1 + t
..
.
= n1 Xtn + 1n1 t(n1) + . . . + 21 t2 + 1 t1 + t
Since |1 | < 1
X
Xt = i1 ti
i=0
= t + 1 t1 + 2 t2 + . . .
with i = i1
A stable AR(1) process can be written as an MA() process
(the same is true for stable AR(p) processes)
(1 1 L)Xt = t
Xt = (1 1 L)1 t
X
Xt = (1 L)i t
i=0
(L)Xt = t
Xt = ((L))1 t
= (L)t
Xt = t + 1 t1
1 Xt1 = 1 t1 + 12 t2
we find Xt = 1 Xt1 + t 12 t2
Repeated substitution of the ti terms yields
X
Xt = i Xti + t with i = (1)i+1 1i
i=1
Summary
(z) = 0
(z) = 0
(L)Xt = (L)t
Xt = ((L))1 (L)t
((L))1 (L)Xt = t
Special case: Dt = t =
ARMA(p, q) process with constant (non-zero) expectation
Xt = 1 (Xt1 ) + . . . + p (Xtp )
+t + 1 t1 + . . . + q tq
Xt = c + 1 Xt1 + . . . + p Xtp + t + 1 t1 + . . . + q tq
where c = (1 1 . . . p )
(L) = 1 L
(L) = 1 L4
(L) = 1 L12
(L) = 1 + L + L2 + L3 /4
Xt = Gt + Ct
where A = (I + K 0 K )1 with
1 2 1 0 0 ... 0 0 0
0 1 2 1 0 ... 0 0 0
K = 0 0
1 2 1 ... 0 0 0
.. .. .. .. .. . .. ..
. . . ..
. . . . . . .
0 0 0 0 0 . . . 1 2 1
= 10 annual data
= 1600 quarterly data
= 14400 monthly data
Xt = c + 1 Xt1 + . . . + p Xtp + t
Compact notation: y = X + u
Xt = c + 1 Xt1 + . . . + p Xtp + t + 1 t1 + . . . + q tq
for t ,
t = Xt c 1 Xt1 . . . p Xtp 1 t1 . . . q tq
Since the residuals are defined recursively one needs starting values
0 , . . . , q+1 and X0 , . . . , Xp+1 to calculate 1
Easiest way: Set all starting values to zero ( conditional estimation)
XT
Expectation vector
X1 c/ (1 1 . . . p )
= E ... = ..
.
XT c/ (1 1 . . . p )
Covariance matrix
X1 (0) . . . (T 1)
(1)
X2 (1) . . . (T 2)
(0)
= Cov . =
.. .. .. ..
..
. .
. .
XT (T 1) (T 2) . . . (0)
H0 : g () = 0
H1 : not H0
H0 : = 0
H1 : not H0
Test statistic
W = ( 0 )0 Cov
d ()( 0 )
d
If the null hypothesis is true then W U 2m
The asymptotic covariance matrix can be estimated consistently as
d () = H 1 where H is the Hessian matrix returned by the
Cov
maximization procedure
Test example 1:
H0 : 1 = 0
H1 : 1 6= 0
Test example 2
H0 : = 0
H1 : not H0
Illustration (arma33.R)
AIC = ln 2
|{z} + 2 (p + q + 1) /T
| {z }
goodness-of-fit penalty
BIC = ln 2 + (p + q + 1) ln T /T
HQ = ln 2 + 2 (p + q + 1) ln (ln T ) /T
Both BIC and HQ are consistent while the AIC tends to overfit
Illustration (arma33.R)
= 1 L,
then
Xt = Xt Xt1
Second order differences
2 = () = (1 L)2 = 1 2L + L2
Xt = + (L)t
Xt I (2)
2
Xt I (0)
Xt = Xt Xt1
= b + t
= b + (L)t
Xt = b + t t1
= (L)t
(L) = (1 L)1 = 1 + L + 2 L2 + 3 L3 + 4 L4 + . . .
Xt = 0.5Xt1 0.4Xt2 + t
Yt = a + bt + Xt
Yt = b + Xt
1
with Xt = (L)t = (1 L) 1 0.5L + 0.4L2 t
and therefore (1) = 0 (i0andi1.R)
(L)d Xt = (L)t
Xt = 1 Xt1 + t
plim 1 = 1
d
T 1 1 Z N 0, 1 21
plim 1 = 1
d
T 1 1 V
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 100 / 143
Integrated processes
Unit root tests
Xt = deterministics + Xt1 + t
Xt = deterministics + ( 1) Xt1 + t
| {z }
=:
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 101 / 143
Integrated processes
Unit root tests
H0 : = 1 (unit root)
H1 : || < 1 (no unit root)
or, equivalently,
H0 : = 0 (unit root)
H1 : < 0 (no unit root)
Unit root tests are one-sided; explosive process are ruled out
Rejecting the null hypothesis is evidence in favour of stationarity
If the null hypothesis is not rejected, there could be a unit root
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 102 / 143
Integrated processes
DF test and ADF test
Possible regressions
Xt = Xt1 + t or Xt = Xt1 + t
Xt = a + Xt1 + t or Xt = a + Xt1 + t
Xt = a + bt + Xt1 + t or Xt = a + bt + Xt1 + t
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 103 / 143
Integrated processes
DF test and ADF test
Xt = Xt1 + t
H0 : = 0
H1 : < 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 104 / 143
Integrated processes
DF test and ADF test
Xt = a + Xt1 + t
H0 : = 0 or H0 : = 0, a = 0
H1 : < 0 or H0 : < 0, a 6= 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 105 / 143
Integrated processes
DF test and ADF test
Xt = a + bt + Xt1 + t
H0 : = 0 or = 0, b = 0
H1 : < 0 or < 0, b 6= 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 106 / 143
Integrated processes
DF test and ADF test
-test : T
-test : /
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 107 / 143
Integrated processes
DF test and ADF test
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 108 / 143
Integrated processes
DF test and ADF test
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 109 / 143
Integrated processes
DF test and ADF test
Phillips-Perron test
Structural breaks and unit roots
KPSS test of stationarity
H0 : Xt I (0)
H1 : Xt I (1)
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 110 / 143
Integrated processes
Regression with integrated processes
Yt = + Xt + ut
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 111 / 143
Integrated processes
Regression with integrated processes
Definition: Cointegration
Two stochastic processes (Xt )tT and (Yt )tT are cointegrated if both
processes are I (1) and there is a constant such that the process
(Yt Xt ) is I (0)
Yt = + Xt + ut
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 112 / 143
GARCH models
Conditional expectation
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 113 / 143
GARCH models
Conditional variance
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 114 / 143
GARCH models
Rules for conditional expectations
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 115 / 143
GARCH models
Basics
Some economic time series show volatility clusters, e.g. stock returns,
commodity price changes, inflation rates, . . .
Simple autoregressive models cannot capture volatility clusters since
their conditional variance is constant
Example: Stationary AR(1)-process, Xt = Xt1 + t with || < 1;
then
2
Var (Xt ) = X2 = ,
1 2
and the conditional variance is
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 116 / 143
GARCH models
Basics
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 117 / 143
GARCH models
ARCH(1)-process
Definition: ARCH(1)-process
The stochastic process (Xt )tZ is called ARCH(1)-process if
E (Xt |Xt1 ) = 0
Var (Xt |Xt1 ) = t2
2
= 0 + 1 Xt1
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 118 / 143
GARCH models
ARCH(1)-process
Xt = t t
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 119 / 143
GARCH models
ARCH(1)-process
E (Xt |Xt1 ) = 0
E (Xt ) = 0
2
Var (Xt |Xt1 ) = 0 + 1 Xt1
Var (Xt ) = 0 / (1 1 )
Cov (Xt , Xti ) = 0 for i > 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 120 / 143
GARCH models
ARCH(1)-process
Xt2 = 0 + 1 Xt1
2
+ vt
with vt = t2 (2t 1)
Thus, squared returns of ARCH(1) are AR(1)
The process (vt )tZ is white noise
E (vt ) = 0
Var (vt ) = E (vt2 ) = const.
Cov (vt , vti ) = 0 (i = 1, 2, . . .)
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 121 / 143
GARCH models
ARCH(1)-process
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 122 / 143
GARCH models
Estimation of an ARCH(1)-process
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 123 / 143
GARCH models
Estimation of an ARCH(1)-process
OLS estimator of 1
T
Xt2 Xt2 Xt1
2 X2
P
t=2 t1
1 = PT 2 2 (Xt2 , Xt1
2
)
X X 2
t=2 t1 t1
Careful: These
p estimators are only consistent if the kurtosis exists
(i.e. if 1 < 1/3)
Test of ARCH-effects
H0 : 1 = 0
H1 : 1 > 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 124 / 143
GARCH models
Estimation of an ARCH(1)-process
Xt2 = 0 + 1 Xt1
2
+ vt ,
then under H0
appr
T 12 TR 2 21
Reject H0 if TR 2 > F1
2 (1 )
1
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 125 / 143
GARCH models
ARCH(p)-process
Definition: ARCH(p)-process
The stochastic process (Xt )tZ is called ARCH(p)-process if
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 126 / 143
GARCH models
ARCH(p)-process
Example of an ARCH(p)-process
Xt = t t
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 127 / 143
GARCH models
ARCH(p)-process
Xt2 = 0 + 1 Xt1
2 2
+ . . . + p Xtp + vt
E (vt ) = 0
Var (vt ) = const.
Cov (vt , vti ) = 0 for i = 1, 2, . . .
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 128 / 143
GARCH models
Estimation of ARCH(p) models
OLS estimation of
Xt2 = 0 + 1 Xt1
2 2
+ . . . + p Xtp + vt
Test of ARCH-effects
H0 : 1 = 2 = . . . = p = 0 vs H1 : not H0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 129 / 143
GARCH models
Maximum likelihood estimation
is maximized
Let X1 , . . . , XT denote a random sample from X
The density fX (x; ) depends on R unknown parameters
= (1 , . . . , R )
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 130 / 143
GARCH models
Maximum likelihood estimation
ML estimate
= argmax [ln L ()]
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 131 / 143
GARCH models
Maximum likelihood estimation
or
T
X
ln fX1 ,...,XT (x1 , . . . , xT ) = ln fXt (xt )
t=1
T
X
= ln fX (xt )
t=1
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 132 / 143
GARCH models
Maximum likelihood estimation
or
T
X
ln fX1 ,...,XT (x1 , . . . , xT ) = ln fXt |Xt1 ,...,X1 (xt |xt1 , . . . , x1 )
t=1
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 133 / 143
GARCH models
Maximum likelihood estimation
ln L(0 , 1 |x1 , . . . , xT )
T T 2
T 1X 1X xt
= ln 2 ln t2
2 2 2 t
t=2 t=2
where t2 = 0 + 1 xt1
2
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 134 / 143
GARCH models
GARCH(p,q)-process
Definition: GARCH(p,q)-process
The stochastic process (Xt )tZ is called GARCH(p, q)-process if
for t Z with i , i 0
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 135 / 143
GARCH models
GARCH(p,q)-process
Unconditional variance
0
Var (Xt ) = Pp Pq
1 i=1 i j=1 j
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 136 / 143
GARCH models
GARCH(p,q)-process
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 137 / 143
GARCH models
Estimation of GARCH(p,q)-processes
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 138 / 143
GARCH models
Estimation of GARCH(p,q)-processes
ln L(0 , 1 , 1 |x1 , . . . , xT )
T T 2
T 1X 1X xt
= ln 2 ln t2
2 2 2 t
t=2 t=2
with t2 = 0 + 1 xt1
2 2
+ 1 t1 and 12 = 0
ML-estimation of 0 , 1 and 1 by numerical maximization
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 139 / 143
GARCH models
Estimation of GARCH(p,q)-processes
2
Conditional h-step forecast of the volatility t+h in a GARCH(1, 1)
model
2
h 2 0
E t+h |Xt , Xt1 , . . . = (1 + 1 ) t
1 1 1
0
+
1 1 1
If the process is stationary
2 0
lim E (t+h |Xt , Xt1 , . . .) =
h 1 1 1
Simulation of GARCH-processes is easy; the estimation can be
computer intensive
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 140 / 143
GARCH models
Residuals of an estimated GARCH(1,1) model
Careful: Residuals are slightly different from what you know from OLS
regressions
Estimates: 0 , 1 , 1 ,
From t2 = 0 + 1 Xt1
2 + 2
1 t1 and Xt = + t t we calculate
the standardized residuals
Xt Xt
t = =q
t 2 + 2
0 + 1 Xt1 1 t1
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 141 / 143
GARCH models
AR(p)-ARCH(q)-models
Xt = + 1 Xt1 + t
t2 = 0 + 1 2t1
where t N(0, t2 )
mean equation / variance equation
Maximum likelihood estimation
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 142 / 143
GARCH models
Extensions of the GARCH model
Andrea Beccarini (CQE) Time Series Analysis Winter 2013/2014 143 / 143