Professional Documents
Culture Documents
Time Series: Chapter 4 - Estimation
Time Series: Chapter 4 - Estimation
Chapter 4 - Estimation
ARIMA(p, d, q) Model
Questions:
Given the order (p, d, q), how to estimate the unknown parameters ?
Example 1
Find the method of moment estimators of θ and σ 2 in the MA(1) model
Yt = Zt − θZt−1 , Zt ∼ W N (0, σ 2 ) .
Theoretical moments:
θ
ρ(1) = − 1+θ 2
γ(0) = (1 + θ2 )σ 2
Sample moments:
Pn−1
r1 = P(Yn t −Y )(Yt+12 −Y )
t=1
(Yt −Y )
Pn t=1
C0 = n1 t=1 (Yt − Y )2
The estimates satisfy
√
θ −1± 1−4r12
r1 = − b ⇒ r1 θb2 + θb + r1 = 0 ⇒ θb = 2r1
1+bθ2
C0 = (1 + θb2 )b
σ2 ⇒ σ b2 = C0 2
1+bθ
Example: Find the Yule Walker estimate for fitting an AR(2) model to the
time series (−1.4, 0.39, 0.97, 1.5, 0.59, −2.4, −2.2, −1.5, −0.42, 0.10).
Procedure:
1 From the ARMA model φ(B)Yt = θ(B)Zt , estimate the noise sequence
{Zt } from the observation {Yt }, conditional on Ys = Zs = 0 for s ≤ 0
(so we require the MA model to be invertible!)
Example 3
ARMA(1,1): Yt − φYt−1 = Zt − θZt−1
1 Conditional on Z0 = 0, Y0 = 0, we have
Z̃1 = Y1
Z̃2 = Y2 − φY1 + θZ̃1
Z̃3 = Y3 − φY2 + θZ̃2
...
Z̃n = Yn − φYn−1 + θZ̃n−1
Pn 2
2 Minimize S∗ (φ, θ) = t=1 Z̃t by numerical optimization
ARMA(p, q) model:
Yt = µ + φ1 Yt−1 + · · · + φp Yt−p + Zt + θ1 Zt−1 + · · · + θq Zt−q ,
Zt ∼ W N (0, σ 2 )
Except for some simple models such as AR(1), we have to employ
numerical optimization for the estimation.
arima(x, order = c(0L, 0L, 0L),
seasonal = list(order = c(0L, 0L, 0L), period = NA),
xreg = NULL, include.mean = TRUE,
fixed = NULL, init = NULL,
method = c("CSS-ML", "ML", "CSS"))
Examples:
set.seed(1234)
x=arima.sim(n=1000,
model=list(ar=c(0.7,-0.12),ma=c(0.7)))
arima(x,order=c(2,0,1))
arima(x,order=c(2,0,1),include.mean=F)
Estimation (Time Series) Chapter 4 23 / 53
...
Agenda
1 Introduction
2 Estimation of Parameters in Time Series Models
Moment Estimators (All models)
Yule Walker Estimators (AR model only)
Least Squares Estimators (AR model only)
Conditional Least Squares Estimators (MA/ARMA models)
Maximum Likelihood Estimator (All models)
3 Inference of Parameters in Time Series Models
General M-estimation Theory: MM/YW/CLS/MLE
LSE
4 Order Selection
Graphical Methods using ACF/PACF
Information Criteria
5 Residual Analysis
6 Model Building
Estimation (Time Series) Chapter 4 24 / 53
...
Agenda
1 Introduction
2 Estimation of Parameters in Time Series Models
Moment Estimators (All models)
Yule Walker Estimators (AR model only)
Least Squares Estimators (AR model only)
Conditional Least Squares Estimators (MA/ARMA models)
Maximum Likelihood Estimator (All models)
3 Inference of Parameters in Time Series Models
General M-estimation Theory: MM/YW/CLS/MLE
LSE
4 Order Selection
Graphical Methods using ACF/PACF
Information Criteria
5 Residual Analysis
6 Model Building
Estimation (Time Series) Chapter 4 25 / 53
...
Statistical Inference for General Time Series
Examples:
γ(0) − C0
Method of Moment: M (θ) =
γ(1) − C1
r1 − φ1 − · · · − φp rp−1
r2 − φ1 r1 − · · · − φp rp−2
Yule Walker: M (θ) =
······
rp − φ1 rp−1 − · · · − φp
∂S(θ) ∂S(θ) 0 Pn
CLS: M (θ) = ∂θ1
··· ∂θk , where S(θ) = t=1
Z̃t2
∂L(θ) ∂L(θ) 0
MLE: M (θ) = ∂θ1
··· ∂θk , where L(θ) is the likelihood
where
γ(0) γ(1) ··· γ(p − 1)
γ(1) γ(0) ··· γ(p − 2)
Γp =
.. .. .. ..
. . . .
γ(p − 1) γ(p − 2) ··· γ(0)
Proof:
Regression result: If β̂ = (X 0 X)−1 X 0 Y , then (β̂ − β) ∼ N (0, σ 2 (X 0 X)−1 ).
Yt−1
.. (Yt−1 · · · Yt−p ) ≈ n (γ(|i − j|))i,j=0,...,p−1 = nΓp
Pn
Now X 0 X = t=p+1 .
Yt−p
ρ(h) = φ|h| .
Proof:
Yk+1 − φ1 Yk − · · · − φp Yk−p+1 = Zk is uncorrelated with all {Yj }j≤k−p
⇒ (φ1 , . . . , φp , 0, . . . , 0) minimizes E(Yk+1 − β1 Yk − · · · − βk Y1 )2 for
k ≥ p.
Interpretation: Given Yk , . . . , Yk−p+1 , additional
Yk−p , Yk−p−1 , · · · , Y1 cannot explain more information about Yk+1
On the other hand: φ11 , φ22 , . . . , φpp are non-zero
PACF function has a cut-off at lag p.
−1
φk1 ρ(0) ··· ρ(k − 1) ρ(1)
.. .
. .. .. ..
. =
. . . .
φkk ρ(k − 1) · · · ρ(0) ρ(k)
θ
Example: MA(1): Yt = Zt + θZt−1 . Recall ρ(1) = 1+θ2
, ρ(k) = 0 (k ≥ 2).
1st lag PACF is:
θ
φ11 = ρ(0)−1 ρ(1) = ρ(1) =
1 + θ2
For 2nd lag PACF,
−1
φ21 1 ρ(1) ρ(1)
=
φ22 ρ(1) 1 0
1 1 −ρ(1) ρ(1) 1 ρ(1)
= =
1 − ρ(1)2 −ρ(1) 1 0 1 − ρ(1)2 −ρ2 (1)
−ρ2 (1) 2
The 2nd lag PACF is φ22 = 1−ρ2 (1)
= − 1+θθ2 +θ4 .
Estimation (Time Series) Chapter 4 35 / 53
...
Graphical Methods for order selection using ACF/PACF
−1
φk1 ρ(0) ··· ρ(k − 1) ρ(1)
.. .
. .. .. ..
. =
. . . .
φkk ρ(k − 1) · · · ρ(0) ρ(k)
θ
Example: MA(1): Yt = Zt + θZt−1 . Recall ρ(1) = 1+θ2
, ρ(k) = 0 (k ≥ 2)
For kth lag PACF, we solve
1 ρ(1)
ρ(1)
ρ(1) 1 ρ(1) φk1 0
ρ(1) 1 ρ(1) φk2
0
. =
··· ..
.
..
ρ(1) 1 ρ(1) φkk
ρ(1) 1 0
Summary:
AR(p) Model -
ACF plot: No clear pattern except AR(1) shows exponential decay
pattern
PACF plot: Cut-off at lag p
MA(q) Model -
ACF plot: Cut-off at lag q
PACF plot: No clear pattern except MA(1) shows exponential decay
pattern
AR(1)
AR(3)
Estimation (Time Series) Chapter 4 38 / 53
...
Examples on ACF and PACF
ACF PACF
MA(1)
MA(4)
Try:
x=arima.sim(1000,model=list(ar=c(0.2,0.4,0.3)))
pacf(x)
Which model will you decide?
Idea of FPE:
For an AR(p) Model, the Mean Square Error of parameter estimate is
M SE = E(φ b − φ) ≈ σ 2 n + p
b − φ)0 (φ (1)
n
n
The best unbiased estimator for σ 2 is σ
b2 n−p
2 2 n
Substituting σ by σb n−p in (1) gives the best estimator of MSE
(define as FPE).
We find the model (AR(1), AR(3), etc) that minimizes FPE.
Note the trade-off between goodness of fit and the model complexity
AIC -
!
b Sx (β)
b
−2 log L β, + 2(p + q + 1)
n
AICC (AIC corrected) -
!
b Sx (β) 2(p + q + 1)n
b
−2 log L β, +
n n−p−q−2
where
Xn
Sx (β)
b = (Xt − φb1 Xt−1 − · · · − φbp Xt−p − θb1 Zt−1 − · · · − θbq Zt−q )2
t=1
βb = (φb1 , . . . , φbp , θb1 , . . . , θbq ) is the MLE
n2
1 1
L(β,
bσ b2 ) = exp − Sx (β)
b
2πb σ2 2πb σ2
Idea -
AIC/AICC estimates the expected likelihood function E[LY (β,
b σb 2 )]
β,
b σb2 are MLE from the observation X = {X1 , . . . , Xn }
Y is a ’new’ observation independent of X
" #
b2
nσ √
BIC = (n − p − q) log + n(1 + log 2π)
n−p−1
"P #
n 2 b2
− nσ
i=1 Xi
+(p + q) log
p+q
IC=function(x,order.input=c(1,0,1)){
fit=arima(x,order=order.input);
n=length(x);p=order.input[1];q=order.input[3];sig=fit$ sigma2
FPE=sig*(n+p)/(n-p);AIC=fit$ aic
BIC=(n-p-q)*log(n*sig/(n-p-1))+n*(1+log(sqrt(2*pi)))+
(p+q)*log((sum(x∧2)-n*sig)/(p+q)); return(c(FPE,AIC,BIC)) }
Example:
Data= (−0.63, −1.8, −0.98, −0.67, −1.14, −1.67, −2.35, −1.70).
Is ARMA(1,1) or AR(2) better?
x=c(-0.63,-1.8,-0.98,-0.67,-1.14,-1.67,-2.35,-1.70)
IC(x,order=c(1,0,1))
IC(x,order=c(2,0,0))
Estimation (Time Series) Chapter 4 47 / 53
...
Agenda
1 Introduction
2 Estimation of Parameters in Time Series Models
Moment Estimators (All models)
Yule Walker Estimators (AR model only)
Least Squares Estimators (AR model only)
Conditional Least Squares Estimators (MA/ARMA models)
Maximum Likelihood Estimator (All models)
3 Inference of Parameters in Time Series Models
General M-estimation Theory: MM/YW/CLS/MLE
LSE
4 Order Selection
Graphical Methods using ACF/PACF
Information Criteria
5 Residual Analysis
6 Model Building
Estimation (Time Series) Chapter 4 48 / 53
...
Residual Analysis
Fitted values and residuals:
Once we obtained the estimates, say φ̂ and θ̂ in ARMA(1,1) model
Yt = φYt−1 + Zt + θZt−1 , we can compute the fitted values, {Ybt },
and residuals, {Zbt }, by the following recursions:
1 Ŷ1 = 0; Zb1 = Y1 − Yb1
2 Ŷ2 = φ̂Y1 + θ̂Z
b1 ; Zb2 = Y2 − Yb2
3 Ŷ3 = φ̂Y2 + θ̂Z
b2 ; Zb3 = Y3 − Yb3
4 ······
5 Ŷn = φ̂Yn−1 + θ̂Zbn−1 ; Zbn = Yn − Ybn
If the model fits the data well, then the fitted values {Ybt } should be
closed to the observed time series {Yt }, i.e., the residuals
Zbt = Yt − Ybt
Zbt = Yt − Ybt
STEPS -
1 Time series plot of Zbt (should look like white noises)
2 ACF plot of the ACF of Zbt , rbZ (j).
Good fit if most rbZ (j) are within the C.I. − √2n , √2n , j 6= 0.
3 Portmanteau Statistics
2
Xh rbZ (j)
Q(h) = n(n + 2) → χ2 (h − p − q)
j=1 n−j
STEPS -
1 Time series plot of Zbt (should look like white noises)
2 ACF plot of Z bt , rbZ (j).
Good fit if all rbZ (j) are within the C.I. − √2n , √2n , j 6= 0.
2
Ph b rZ (j)
3 Portmanteau Statistics Q(h) = n(n + 2) j=1 n−j ∼ χ2 (h − p − q).
Example ARMA(1,1): Yt = φYt−1 + Zt + θZt−1 .
set.seed(6104)
x=arima.sim(1000,model=list(ar=c(0.2), ma=c(0.6)))
n=length(x)
fit=arima(x,order=c(1,0,1))
par(mfrow=c(2,1))
ts.plot(fit$ res)
r.z=as.numeric(acf(fit$ res,12)$ acf) ## h=12
portmanteau.stat=n*(n+2)*sum((r.z[-1]∧2)/(n-(1:12)))
portmanteau.stat>qchisq(0.95,12-1-1) ## FALSE: not reject H0
or tsdiag(fit)
Three Stages -
1. Model Specification
Trend, seasonal effect, choosing ARIMA model by FPE/AIC/BIC
2. Model Identification (estimating coefficient)
MM, YW, LSE, CLS, MLE,
3. Model Checking(diagnostic)
Residual analysis (ts.plot/acf of {Zbt })
Portmanteau test