04 ARIMA Models
04 ARIMA Models
04 ARIMA Models
? Identification ?
The time series is strictly (or strongly) stationary if its properties do not
depend on modifications of the time origin
I.e., the joint distribution of : X t1 , X t2 , X t3 ,! X tm
coincides with the joint distribution of X t1 + k , X t2 + k , X t3 + k ,! X tm + k "k
We refer to weak stationarity of order f if all the moments of the series up to order
f only depend on the time difference between the time series data
2
e t ~ NID(0,s e )
General mode for stochastic model (linear)
X t = x + f1 X t -1 + e t e t ~ NID(0, s 2 )
Model AR(1)
(Markov process)
For a stationary process: E( X t ) = µ
E ( X t ) = x + f1E ( X t -1 ) + 0 Þ (1 - f1 ) µ = x
X t = (1 - f1 ) µ + f1 X t -1 + e t
~ ~
X t - µ = f1 ( X t -1 - µ ) + e t X t º X t - µ = f1 ( X t -1 ) + e t
Quality Engineering 5
AR(p)
X t = x + f1X t -1 + f2 X t -2 + ... + f p X t - p + e t
Analogously, for a stationary process: E( X t ) = µ
p ~ p ~
(1 - å fi ) µ = x Þ X t º X t - µ = å fi X t -i + e t
i =1 i =1
Backshift operator B : X t -2 = BX t -1 = B( BX t ) = B 2 X t
p
~ i ~ ~
X t = å fi B X t + e t Þ A( B) X t = e t
i =1
p
where A( B ) = 1 - å fi B i
Quality Engineering 6 i =1
Stationarity
~
E.g.: AR (1) : (1 - f1 B) X t = e t
1 ì f1 < 1 stationary
A( B) = 1 - f1 B = 0 Þ B = í
f1 î f1 ³ 1 non stationary
The Jury’s test is used to test the stability of AR(p) processes
Quality Engineering 7
Some intuitive remarks
~ ~ ~ 2~
X t = f1 ( X t -1 ) + e t = f1 (f1 ( X t - 2 ) + e t -1 ) + e t = f1 X t - 2 + f1e t -1 + e t =
( ~
) 3~
= f1 f1 ( X t -3 ) + e t - 2 + f1e t -1 + e t = f1 X t -3 + f12e t - 2 + f1e t -1 + e t =
2
¥
= ... = å f1ie t -i
i =0
f1 < 1 Þ
Quality Engineering 8
Moments of an AR(p) process
gk
rk = = f1r k -1 + f2 r k -2 + ... + f p r k - p k = 1,2,...,
g0
Quality Engineering 9
The same finite difference equation of the original AR(p) process applies
also to the autocovariance and autocorrelation functions
Variance: ( ~
s 2X = g 0 = f1g -1 + f 2g -2 + ... + f pg - p + E e t X t = ) (Autocovariance:
symmetric function)
= f1g 1 + f 2g 2 + ... + f pg p + s e2
SACF : rˆ k = rk
(f1 = 0.8)
SACF : rˆ k = rk
(f1 = -0.8)
Quality Engineering 11
Note: It’s a general result, true for every stationary AR(p) process
~ ~ ~ ~
Xt X t -1 X t -2 X t -3
f1 f1 f1
Quality Engineering 13
Regression Analysis: Y(t) versus Y(t)_2
The regression equation is: Y(t) = 1.52 + 0.565 Y(t)_2
Predictor Coef SE Coef T P
Constant 1.5199 0.3070 4.95 0.000
Y(t)_2 0.56527 0.08198 6.90 0.000
Quality Engineering 14
@
Regression Analysis: Y(t) versus Y(t)_1, Y(t)_2
The regression equation is
Y(t) = 0.858 + 0.848 Y(t)_1 - 0.096 Y(t)_2
Quality Engineering 15
Non stationary AR(1) process: random walk with drift
X t = x + X t -1 + e t
x ¹ 0 :" drift "
X t = x + X t -1 + e t = x + x + X t -2 + e t -1 + e t =
t -1 i
= 3x + X t -3 + e t -2 + e t -1 + e t = ... = tx + å B e t
i =0
E ( X t ) = µt = tx
V ( X t ) = ts e2
g
It’s possible to demonstrate that, being X0=0: k ,t = ts e and ρk = 1 "k
2
(dow.dat)
MA ( q ) : X t = µ - q1e t -1 - q 2e t - 2 - ... - q q e t - q + e t
~
X t = X t - µ = -q1e t -1 - q 2e t -2 - ... - q q e t -q + e t
~
( )
With the backshift operator: X t = 1 - q1B - q 2 B 2 - ... - q q B q e t º C ( B)e t
Note: the invertibility concept for MA(q) processes is analogous to the stationarity
concept for AR(p) processes
Quality Engineering 20
Moments of a MA(q) process
Mean:
E( X t ) = E(µ -q1e t -1 -q 2e t -2 - ... -q qe t -q + e t ) = µ
Variance: g 0 = s 2X = V ( X t ) = V ( µ - q1e t -1 - q 2e t -2 - ... - q qe t -q + e t ) =
= (1 + q12 + q 22 + ... + q q2 )s e2
Quality Engineering 21
Autocorrelation:
ì (-q k + q1q k +1 + q 2q k + 2 + ... + q q -kq q )
gk ï k = 1,2,...,q
rk = = í 1 + q12 + q 22 + ... + q q2
g0 ï
î0 k >q
By means of the SACF one can identify a MA process and its order q,
depending on the number of lags such that rk¹0
Special cases:
ì - q1
ï k =1
MA(1): X t = µ - q1e t -1 + e t E( X t ) = µ g 0 = (1 + q12 )s e2 r k = í1 + q 2
1
ï0 k >1
î
ì - q1 + q1q 2
ï k =1
2 2
MA(2): X t = µ -q1e t -1 -q 2e t -2 + e t ï 1 + q1 + q 2
ï -q 2
rk = í k=2
E( X t ) = µ g 0 = (1 + q12 + q 22 )s e2 2
ï1 + q1 + q 2
2
ï0 k>2
Quality Engineering 22 ï
ïî
Initial example: it was a MA(1) process
MA(1)
Example: 500
consecutive
observations from a
productive process
Quality Engineering 23
ARMA(p,q) models
A model that includes both the AR(p) and the MA(q) terms:
Apart from the first q lags, the ACF “resembles” the ACF of an AR(p)
process.
~ d ~
A( B) X t = A p ' ( B)(1 - B) X t = C q ( B )e t
Where:
• Ap’(B) is the degree p polynomial (AR term) with all roots falling outside the unit
circle;
• d is the degree of the I term (integrated) within the ARIMA model
• Cq(B) is the degree q polynomial of MA term
Quality Engineering 26
In order to deal with ARIMA (p,d,q) processes, one has to transform the
process into a stationary one by applying the difference operator (nabla)
ÑX t º X t - X t -1 = (1 - B ) X t
Example 2: ARIMA(0,1,1)=IMA(1,1)
A process that often occurs in industial applications is IMA(1,1)
Quality Engineering
(1 - B27) X t = -q1e t -1 + e t
Development of an ARIMA(p,d,q) model
Iterative procedure:
Identification Finding the values of p,d,q
Coefficients estimate
no (fˆ1,..., fˆ p ,qˆ1,...,qˆq )
Diagnostic check on residuals
yes STOP
OK?
Quality Engineering 29
Identification of other parameters (p,q)
Quality Engineering 30
After the identification step (p,d,q) – coefficients estimation
Note:
We noticed that regression (least squares method) can be used for
AR(p) models too:
When n is large enough, the two methods converge to the same
results
Stationary?
no
yes d:=d+1
Apply Ñd
SACF-SPACF: choose
ARIMA model to test
Find a
model for
residuals* Coefficients estimation
and residuals computation
no yes
Residuals are IID (NID)? STOP
Quality Engineering 32
* One can try to identify and fit an ARMA(pe,qe) model on residuals
Aˆ pe ( B)et = Cˆ qe ( B)at
If the model is correct (at= IID), such a model can be combined with the
original ARIMA(p,d,q) model, as follows:
d ~ Cˆ qe ( B )
A( B )Ñ X t = Cˆ ( B )et
ˆ et = at
ˆ
A ( B)
pe
ˆ ( B)
C
ˆ d ~ ˆ qe
A( B )Ñ X t = C ( B ) at
ˆ
A pe ( B )
d ~
A( B ) A pe ( B )Ñ X t = Cˆ ( B )Cˆ qe ( B )at
ˆ ˆ
viscosity
Viscosity of a chemical product 25
Quality Engineering 34
Autocorrelation Function for viscosity
1.0
Autocorrelation
0.8
0.6
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
5 15 25
Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ
1 0.49 4.94 25.13 8 -0.01 -0.08 51.19 15 -0.12 -0.87 57.41 22 -0.04 -0.30 68.37
2 -0.05 -0.41 25.39 9 -0.09 -0.66 52.16 16 -0.11 -0.78 58.95 23 -0.17 -1.12 72.13
3 -0.26 -2.16 32.73 10 -0.11 -0.75 53.44 17 -0.09 -0.62 59.96 24 -0.19 -1.22 76.74
4 -0.28 -2.22 41.25 11 -0.07 -0.53 54.08 18 0.00 0.03 59.96 25 -0.06 -0.41 77.27
5 -0.07 -0.54 41.82 12 0.03 0.22 54.19 19 0.16 1.08 63.06
6 0.22 1.63 46.99 13 0.01 0.09 54.21 20 0.18 1.24 67.29
7 0.20 1.42 51.18 14 -0.11 -0.74 55.54 21 0.08 0.53 68.12
• Stationarity seems ok
• SACF seems to exhibit an exponential decay
Quality Engineering 35
Partial Autocorrelation Function for viscosity
Partial Autocorrelation
1.0
0.8
0.6
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
5 15 25
Quality Engineering 38
Autocorrelation Function for RESI1
1.0
Autocorrelation 0.8
0.6
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
5 15 25
Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ
1 -0.02 -0.25 0.06 8 -0.12 -1.09 9.89 15 -0.05 -0.45 15.67 22 0.00 0.04 18.58
2 -0.02 -0.22 0.11 9 -0.01 -0.11 9.90 16 -0.05 -0.44 15.97 23 -0.06 -0.49 19.00
3 0.11 1.08 1.33 10 0.01 0.10 9.92 17 -0.03 -0.26 16.07 24 -0.13 -1.09 21.13
4 -0.09 -0.91 2.25 11 -0.14 -1.25 12.03 18 -0.04 -0.35 16.27 25 -0.08 -0.71 22.08
5 -0.13 -1.29 4.12 12 0.04 0.34 12.20 19 0.11 0.96 17.76
6 0.17 1.68 7.43 13 0.03 0.24 12.28 20 0.08 0.69 18.56
7 0.09 0.86 8.36 14 -0.16 -1.46 15.36 21 -0.01 -0.09 18.58 Normal Probability Plot
.999
.99
.95
Probability
.80
.50
.20
.05
.01
.001
-5 0 5
RESI1
Quality Engineering 39 Average: -0.0396777
StDev: 3.24524
Anderson-Darling Normality Test
A-Squared: 0.966
N: 100 P-Value: 0.014
SCC
FVC
Quality Engineering 40
Example
7500
weekly demand
moulding (drug production sector)
5500
Index 10 20 30 40 50 60 70 80 90 100
0.8
0.6
0.4
0.2
0.0
-0.2
-0.4
-0.6
It looks like a non-
-0.8
-1.0 stationary process
5 15 25
Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ Lag Corr T LBQ
1 0.96 9.61 95.13 8 0.48 1.58 466.81 15 0.08 0.23 520.48 22 -0.13 -0.38 524.39
2 0.90 5.32 179.07 9 0.41 1.32 486.06 16 0.05 0.14 520.75 23 -0.16 -0.47 527.61
3 0.83 3.93 251.61 10 0.34 1.08 499.54 17 0.02 0.05 520.78 24 -0.17 -0.53 531.68
4 0.76 3.14 312.62 11 0.28 0.87 508.60 18 -0.01 -0.02 520.79 25 -0.18 -0.54 535.97
5 0.69 2.61 363.79 12 0.23 0.70 514.59 19 -0.03 -0.08 520.87
6 0.63 2.23 406.78 13 0.17 0.53 518.10 20 -0.05 -0.17 521.26
7 0.56 1.89 440.93 14 0.12 0.36 519.78 21 -0.09 -0.28 522.34
Quality Engineering 41
Let’s apply the Ñ operator: 500
diff dem
0
-500
Index 10 20 30 40 50 60 70 80 90 100
After differencing:
MA(1)
Quality Engineering 42
Thus, model IMA(1,1):
~ d ~
A( B ) X t = A p ' ( B )(1 - B ) X t = Cq ( B )e t
ARIMA Model: weekly demand
Final Estimates of Parameters
Type Coef SE Coef T P
MA 1 -0.7331 0.0688 -10.66 0.000
300
200
100
RESI3
-100
-200
-300
-400
.999
.99
.95
Probability
.80
.50
.20
.05
.01
.001
Quality Engineering 44
SCC
FVC
Quality Engineering 45