Professional Documents
Culture Documents
Estimation in time
Key references
Jiti Gao
March 5, 2023
1/51
Week 2:
Recall that for a time series {Xt }, we define the Estimation in time
series models
autocovariance function by
Key references
γ(h)
ρ(h) = corr(Xt+h , Xt ) = . (2.2)
γ(0)
2/51
Example 2.1 (MA(1) model): If Zt ∼ WN(0, σ 2 ), then Week 2:
Estimation in time
{Xt } defined by series models
θ1
ρ(1) = and
1 + θ12
ρ(k) = 0, k ≥ 2. (2.3)
3/51
3
2
Week 2:
1
Estimation in time
ts.sim
series models
0
−1
Key references
−2
−3
Time
Series ts.sim
1.0
0.8
0.6
ACF
0.4
0.2
0.0
0 5 10 15 20
Lag
Xt = φ1 Xt−1 + Zt , Zt ∼ WN(0, σ 2 ),
γ(k)
ρ(k) = = φk1 , k = 1, 2, · · · . (2.4)
γ(0)
5/51
3
2
Week 2:
1
Estimation in time
ts.sim
0
series models
−1
−2
Key references
−3
−4
0 20 40 60 80 100
Time
Series ts.sim
1.0
0.8
0.6
0.4
ACF
0.2
0.0
−0.2
0 5 10 15 20
Lag
N
1 X
x̄ = xi , (2.5)
N
i=1
N−k
1 X
ck = (xt − x̄)(xt+k − x̄), (2.6)
N −k
t=1
PN−k
ck N t=1 (xt − x̄)(xt+k − x̄)
rk = = PN
c0 N −k t=1 (xt − x̄)
2
PN−k
t=1 (xt − x̄)(xt+k − x̄)
≈ PN (2.7)
2
t=1 (xt − x̄)
k
when N is very small.
7/51
Week 2:
Estimation in time
series models
8/51
Method of Moments
θ1 Key references
r1 = for the MA(1) case, (2.9)
1 + θ12
r1 = φ1 for the AR(1) case. (2.10)
φb1 = r1 . (2.12)
Xt = φ1 Xt−1 + Zt . (2.13)
over φ1 .
10/51
Week 2:
Estimation in time
This implies that the OLS estimator, φb1 , of φ1 is given by series models
PN Key references
t=1 Xt Xt−1
φ1 = P
b
N
. (2.15)
2
t=1 Xt−1
11/51
Week 2:
Estimation in time
Note that series models
PN
t=1 (φ1 Xt−1 + Zt ) Xt−1 Key references
φb1 = PN 2
t=1 Xt−1
PN
Zt Xt−1
= φ1 + Pt=1 N
. (2.17)
2
t=1 Xt−1
φb1 ≈ φ1 b2 ≈ σ 2 as N is large.
and σ (2.18)
12/51
Week 2:
Estimation in time
series models
13/51
> ar.sim<-arima.sim(list(order=c(1,0,0),ar=0.7),
+ n=500) Week 2:
Estimation in time
> ts.ols<-ar.ols(ar.sim, order.max=1) series models
Call:
ar.ols(ar.sim, order.max = 1)
Coefficients:
1
0.718
13/51
Week 2:
Estimation in time
series models
We now extend the above discussion to an AR(p) model of
Key references
the form
14/51
Week 2:
Estimation in time
series models
The OLS estimation method is to minimize
Key references
N
1 X
(Xt − φ1 Xt−1 − · · · − φp Xt−p )2 (2.20)
N
t=1
over (φ1 , · · · , φp ).
Similarly to the AR(1) case, the OLS estimators,
(φb1 , · · · , φbp ), of (φ1 , · · · , φp ) can be explicitly expressed.
15/51
Week 2:
Estimation in time
Meanwhile, the variance σ 2 = E [Zt2 ] can be estimated by series models
N Key references
2 1 X 2
σ
b = Xt − φb1 Xt−1 − · · · − φbp Xt−p . (2.21)
N
t=1
φbi ≈ φi b2 ≈ σ 2
and σ (2.22)
for all 1 ≤ i ≤ p.
16/51
Week 2:
Estimation in time
series models
Example 2.4: In R, the OLS estimator can be calculated by
Key references
17/51
> ar.sim<-arima.sim(list(order=c(2,0,0),
+ ar=c(0.7, -0.5)), n=200) Week 2:
Estimation in time
> ts.ols<-ar.ols(ar.sim, order.max=2) series models
Call:
ar.ols(x = ar.sim, order.max = 2)
Coefficients:
1 2
0.6709 -0.5413
Intercept: -0.007082.
Order selected 2, and $\sigma^2$ estimated as 1.065.
17/51
Week 2:
Estimation in time
series models
As shown above, both φb1 = 0.6709 and φb2 = −0.5403 are
Key references
close to φ1 = 0.7 and φ2 = −0.5, respectively.
18/51
Week 2:
Estimation in time
Yule–Walker estimation method series models
Key references
Consider an AR(p) model of the form,
19/51
Week 2:
Estimation in time
series models
Multiplying each side of (2.23) by Xt−j , j = 0, 1, . . . , p,
Key references
Xt Xt − φ1 Xt Xt−1 − · · · − φp Xt Xt−p = Xt Zt ,
20/51
Week 2:
Estimation in time
series models
We then have for j = 0, 1, . . . , p,
Key references
21/51
Week 2:
Estimation in time
Using the following results: γ(j) = E [Xt Xt−j ], series models
Xt = ∞
P
j=0 ψj Zt−j , Key references
∞
X
E [Xt Zt ] = ψj E [Zt Zt−j ] = E [Zt2 ] = σ 2 ,
j=0
X∞
E [Xt−k Zt ] = ψj E [Zt Zt−k−j ] = 0 (2.24)
j=0
22/51
Week 2:
Estimation in time
series models
Key references
23/51
Example 2.5. Consider the case where p = 2. We have that Week 2:
Estimation in time
series models
2
γ(0) − [φ1 γ(1) + φ2 γ(2)] = σ , Key references
24/51
Week 2:
Estimation in time
As in the Method of Moments, we replace γ(k) by ck and series models
ρ(k) by rk , respectively to define the estimators, φb1 , φb2 and Key references
b2 ,
σ of φ1 , φ2 and σ2 by the following estimation equations:
1 − r2
φb1 = r1 ,
1 − r12
r2 − r12
φb2 = ,
1 − r12
b2
σ = c0 − [φb1 c1 + φb2 c2 ]. (2.28)
25/51
Week 2:
Estimation in time
series models
Example 2.6: In R, the Yule–Walker estimation method can
Key references
be implemented by using the following code function ar.yw:
ts.yw< − ar.yw(series, order.max=2)
26/51
> ar.sim<-arima.sim(list(order=c(2,0,0),
+ ar=c(0.7, -0.5)), n=500)
> ts.yw<-ar.yw(ar.sim, order.max=2) Week 2:
Estimation in time
> ts.yw series models
Key references
Call:
ar.yw.default(x = ar.sim, order.max = 2)
Coefficients:
1 2
0.7502 -0.4607
27/51
Week 2:
Estimation in time
series models
Maximum likelihood (ML) estimation method
Key references
27/51
Week 2:
Consider an AR(1) model of the form Estimation in time
series models
where Zt ∼ WN(0, σ 2 ).
Let f (·, · · · , ·) be the joint density function of (Z1 , · · · , ZN ),
where Zt = Xt − φ1 Xt−1 . Define the likelihood function by
L(φ1 , σ; X1 , · · · , XN ) = f (Z1 , · · · , ZN )
= f (X1 − φ1 X0 , · · · , XN − φ1 XN−1 ).
28/51
Week 2:
Estimation in time
The maximum likelihood estimation method is to choose series models
b2 ; X1 , · · · , XN )
L(φb1 , σ
= max L(φ1 , σ; X1 , · · · , XN ).
over all φ1 , σ 2
29/51
Week 2:
Example 2.7: Let {Zt } be a sequence of independent and Estimation in time
series models
normally distributed Zt ∼ N(0, σ 2 ). Then
Key references
N
Y N
Y
f (Z1 , · · · , ZN ) = f (Zt ) = f (Xt − φ1 Xt−1 )
t=1 t=1
N (X −φ X )2
Y 1 − t 1 2t−1
= √ e 2σ
t=1
2πσ
N PN (X −φ X )2
1 t=1 t 1 t−1
= √ e− 2σ 2 .
2πσ
30/51
Week 2:
Estimation in time
series models
suffices to minimize
N
X
(Xt − φ1 Xt−1 )2 over φ1 , (2.30)
t=1
31/51
Week 2:
Estimation in time
series models
Key references
32/51
Week 2:
Estimation in time
series models
33/51
simulated data
> ts2.sim<-arima.sim(list(order=c(1,1,1), Week 2:
Estimation in time
+ ar=0.7, ma=0.5), n=500) series models
> ts2.arima
Call:
arima(x = ts2.sim, order = c(1, 1, 1))
Coefficients:
ar1 ma1
0.6820 0.4411
$\sigma^2$ estimated as 0.9606:
log likelihood $= -700.1$.
33/51
Week 2:
Estimation in ARCH and GARCH models Estimation in time
series models
Let {Zt2 } satisfy an ARCH(p) model of the form
Key references
Zt2 = α0 + α1 Zt−1
2 2
+ · · · + αp Zt−p + ut , (2.31)
where ut ∼ WN(0, σ 2 ).
Let Yt = Zt2 − E [Zt2 ]. Then {Yt } follows an AR(p) model of
the form
34/51
1 PN Week 2:
We estimate µ = E [Zt2 ] by µ
b= N
2
t=1 Zt and then Estimation in time
series models
estimate (α1 , · · · , αp ) by (b
α1 , · · · , α
bp ) using an existing
Key references
estimation method in R for an AR(p) model of the form
α b (1 − α
b0 = µ b1 − · · · − α
bp ) . (2.34)
35/51
Week 2:
Estimation in time
series models
Consider a GARCH(1,1) model of the form
Key references
where ut ∼ WN(0, σ 2 ).
Let µ = E [Zt2 ] and Yt = Zt2 − µ. A simple derivation implies
α0
µ= 1−α1 −β1 .
36/51
Week 2:
Estimation in time
The parameters α1 , β1 and α0 can then be estimated by α
b1 , series models
βb1 and α
b0 using a GARCH(1,1) model of the form Key references
37/51
EuStockMarkets
DAX
series models
Key references
SMI
5000
2000
CAC
3000
5000 1500
FTSE
3000
Time
38/51
euro.dat1
Week 2:
Estimation in time
0.00
DAX
series models
Time
39/51
Week 2:
Estimation in time
series models
Example: Consider the Daily Closing Prices of Major
Key references
European Stock Indices: 1991–1998. Let {Zt } be a
sequence the log returns and satisfy model (2.31).
The parameters α0 , α1 , · · · , αp can be estimated using the
following code function:
40/51
> euro.dat<-EuStockMarkets
> euro.dat1<-log(euro.dat) Week 2:
Estimation in time
> euro.dat2<-diff(euro.dat1) series models
#DAX index
> euro.dat4<-euro.dat3[,1]
> euro.arima<-arima(euro.dat4, order=c(3,0,0))
> euro.arima
40/51
Call:
arima(x = euro.dat4, order = c(3, 0, 0)) Week 2:
Estimation in time
Coefficients: series models
41/51
Week 2:
Estimation in time
series models
Example 2.9: Consider the Daily Closing Prices of Major
Key references
European Stock Indices: 1991–1998. Let {Zt } be a
sequence the log returns and satisfy model (2.35).
The parameters α0 , α1 , β1 can be estimated using the
following code function:
41/51
> euro.dat<-EuStockMarkets
> euro.dat1<-log(euro.dat)
> euro.dat2<-diff(euro.dat1) Week 2:
Estimation in time
> euro.dat3<-euro.dat2^2 - mean(euro.dat2^2) series models
Key references
#DAX index
> euro.dat4<-euro.dat3[,1]
> euro.arima<-arima(euro.dat4, order=c(1,0,1))
> euro.arima
41/51
Call:
arima(x = euro.dat4, order = c(1, 0, 1))
Coefficients: Week 2:
Estimation in time
ar1 ma1 intercept series models
42/51
Model Building: R provides some code functions for fitting Week 2:
Estimation in time
auto–regressive integrated moving–average (ARIMA) models series models
42/51
Identifying and Fitting ARIMA Models. Box and Jenkins
(1970) give a paradigm for fitting ARIMA models, which is Week 2:
Estimation in time
to iterate through the following steps: series models
Key references
1. Model Identification: Determination of the ARIMA
model orders (p, d, q).
44/51
Week 2:
To introduce the idea, we start with an AR(p) model of the Estimation in time
series models
form
Key references
where Zt ∼ WN(0, σ 2 ).
The estimated value of Xt and the one–step predictor is then
given by
Xbt = φb1 Xt−1 + · · · + φbp Xt−p . (2.39)
45/51
Week 2:
Estimation in time
Key references
of model identification is then converted into an
optimization problem with respect to a specified
criterion over a pre-selected family of models.
I In what follows, we describe the approach developed by
Akaike (1974) in some detail. Limitation of both space
and our practical experience has indicated this choice.
46/51
Week 2:
Estimation in time
series models
Consider an ARMA(p,q) process. The Akaike’s information
Key references
b2 (p, q) is the
where N is the number of observations, and σ
estimated error variance of σ 2 = E [Z12 ].
47/51
Week 2:
Estimation in time
series models
48/51
Week 2:
Estimation in time
series models
The criteria are used in the following way. Upper bounds,
Key references
say P and Q, are set for the orders of φ(B) and θ(B), and
with P = {0, 1, . . . , Pmax } and Q = {0, 1, . . . , Qmax }, orders
pb and qb are selected such that, for example
AIC (b
p , qb) = min AIC (p, q). (2.42)
p∈P,q∈Q
49/51
Week 2:
Estimation in time
Choice between AIC and BIC: series models
50/51
A simulated example:
> ts.sim<-arima.sim(list(order=c(1,1,1), Week 2:
Estimation in time
+ ar=0.7, ma=0.5), n=500) series models
Call:
arima(x = ts.sim, order = c(1, 1, 1))
Coefficients:
ar1 ma1
0.6344 0.5180
s.e. 0.0398 0.0447
$\sigma^2$ estimated as 0.9749:
+ log likelihood = -703.81, aic = 1413.61.
50/51
Key references
Week 2:
Estimation in time
series models
Key references
Akaike, H. (1974). A new look at the statistical model
identification. IEEE Trans. Autom. Control. AC-19,
716–723.
Box, G. and Jenkins, G. (1970). Time Series Analysis,
Forecasting and Control. Holden–Day, San Francisco.
Schwarz, G. (1978). Estimating the dimension of a model.
Ann. Statist. 6, 461–464.
51/51