1 Previsão | Pedro Paulo Balestrassi | 5 – Autoregressive Integrated Moving Average (ARIMA)...

208
1 Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br 5 – Autoregressive Integrated Moving Average (ARIMA) Models

Transcript of 1 Previsão | Pedro Paulo Balestrassi | 5 – Autoregressive Integrated Moving Average (ARIMA)...

Page 1: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

1Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

5 – Autoregressive Integrated Moving

Average (ARIMA) Models

5 – Autoregressive Integrated Moving

Average (ARIMA) Models

Page 2: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

2Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARIMA Box-Jenkins Methodology

Page 3: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

3Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Index

Index

60544842363024181261

290

280

270

260

250

240

230

220

210

Time Series Plot of Index

The series show an upward trend.

Lag

Auto

corr

ela

tion

16151413121110987654321

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Autocorrelation Function for Index(with 5% significance limits for the autocorrelations)

The first several autocorrelations are persistently large and trailed off to zero rather slowly a trend exists and this time series is nonstationary (it does not vary about a fixed level)

Idea: to difference the data to see if we could eliminate the trend and create a stationary series.

Example 1/4

Page 4: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

4Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

First order differences.

A plot of the differenced data appears to vary about a fixed level.

Index

Diff1

60544842363024181261

5

4

3

2

1

0

-1

-2

-3

-4

Time Series Plot of Diff1

Lag

Auto

corr

ela

tion

16151413121110987654321

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Autocorrelation Function for Diff1(with 5% significance limits for the autocorrelations)

Lag

Part

ial A

uto

corr

ela

tion

16151413121110987654321

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Partial Autocorrelation Function for Diff1(with 5% significance limits for the partial autocorrelations)

Comparing the autocorrelations with their error limits, the only significant autocorrelation is at lag 1. Similarly, only the lag 1 partial autocorrelation is significant. The PACF appears to cut off after lag 1, indicating AR(1) behavior. The ACF appears to cut off after lag 1, indicating MA(1) behavior we will try: ARIMA(1,1,0) and ARIMA(0,1,1)

A constant term in each model will be included to allow for the fact that the series of differences appears to vary about a level greater than zero.

Example 2/4

Page 5: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

5Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARIMA(1,1,0)ARIMA(0,1,1)

Example 3/4

The LBQ statistics are not significant as indicated by the large p-values for either model.

Page 6: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

6Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Lag

Auto

corr

ela

tion

16151413121110987654321

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Autocorrelation Function for RESI1(with 5% significance limits for the autocorrelations)

Lag

Auto

corr

ela

tion

16151413121110987654321

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Autocorrelation Function for RESI2(with 5% significance limits for the autocorrelations)

Therefore, either model is adequate and provide nearly the same one-step-ahead forecasts.

Example 4/4

Finally, there is no significant residual autocorrelation for the ARIMA(1,1,0) model. The results for the ARIMA(0,1,1) are similar.

Page 7: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

7Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Makridakis– ARIMA 7.1– ARIMA PIGS– ARIMA DJ– ARIMA Electricity– ARIMA Computers– ARIMA Sales Industry– ARIMA Pollution

Examples

Minitab– Employ (Food)

Montgomery– EXEMPLO PAG 267– EXEMPLO PAG 271– EXEMPLO PAG 278– EXEMPLO PAG 283

Page 8: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

8Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARIMA Basic Model

Page 9: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

9Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Basic Models

ARIMA (0, 0, 0) ― WHITE NOISE

ARIMA (0, 1, 0) ― RANDOM WALK

ARIMA (1, 0, 0) ― AUTOREGRESSIVE MODEL (order 1)

ARIMA (0, 0, 1) ― MOVING AVERAGE MODEL (order 1)

ARIMA (1, 0, 1) ― SIMPLE MIXED MODEL

Page 10: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

10Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR MA Example Models

ARIMA (0,0,1)=MA(1)

ARIMA (1,0,0)= AR(1)

ARIMA (0,0,2)= MA(2)

ARIMA (2,0,0)= AR(2)

Page 11: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

11Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARMA Example Models

ARIMA(1,01)=ARMA(1,1)

ARIMA(1,01)=ARMA(1,1)

Page 12: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

12Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Autocorrelation - ACF

Lag ACF T LBQ 1 0,0441176 0,15 0,03 2 -0,0916955 -0,32 0,17Diferenças são devido a pequenas

modificações nas fórmulas de Regressão e Time Series

Page 13: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

13Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Correlation

• Suppose X, Y and Z are random variables. We define the notion of partial correlation between X and Y adjusting for Z.

• First consider simple linear regression of X on Z

• Also the linear regression of Y on Z

ZVar

XZCovbZbaX

,whereˆ

111

ZVar

YZCovbZbaY

,whereˆ

222

Page 14: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

14Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Correlation

• Now consider the errors

• Then the partial correlation between X and Y, adjusting for Z, is

ZbaYYYY

ZbaXXXX

22*

11*

ˆ

ˆ

YYXXcorrYXcorr ˆ,ˆ, **

Page 15: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

15Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Autocorrelation - PACF

Diferenças são devido a pequenas modificações nas fórmulas de

Regressão e Time Series

Correlations: X*; Y* Pearson correlation of X* and Y* =0,770P-Value = 0,000

Partial Autocorrelation Function: X Lag PACF T 1 0,900575 6,98 2 -0,151346 -1,17 3 0,082229 0,64

Page 16: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

16Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF 0

PACF = 0 for lag > 1

Theorectical Behavior for AR(1)

0 1 1 2 2 ...t t t p t p tY Y Y Y 0 1 1 2 2 ...t t t p t p tY Y Y Y

Page 17: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

17Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Theorectical Behavior for AR(2)

ACF 0

PACF = 0 for lag > 2

0 1 1 2 2 ...t t t p t p tY Y Y Y 0 1 1 2 2 ...t t t p t p tY Y Y Y

Page 18: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

18Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

PACF 0

ACF = 0 for lag > 1

Theorectical Behavior for MA (1)

1 1 2 2 ...t t t t q t qY 1 1 2 2 ...t t t t q t qY

Page 19: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

19Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Theorectical Behavior for MA(2)

PACF 0

PACF = 0 for lag > 2

1 1 2 2 ...t t t t q t qY 1 1 2 2 ...t t t t q t qY

Page 20: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

20Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Note that:

• ARMA(p,0) = AR(p)

• ARMA(0,q) = MA(q)

0 1 1 2 2 1 1 2 2... ...t t t p t p t t t q t qY Y Y Y 0 1 1 2 2 1 1 2 2... ...t t t p t p t t t q t qY Y Y Y

In practice, the values of p and q each rarely exceed 2.

ACF PACF

AR(p) Die out Cut off after the order p of the process

MA(q) Cut off after the order q of the process

Die out

ARMA(p,q) Die out Die out

In this context…

• “Die out” means “tend to zero gradually”

• “Cut off” means “disappear” or “is zero”

Theorectical Behavior

Page 21: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

21Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Review of Main Characteristics of ACF and PACF

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.,

lagafterofcuts sinusoid damped

and/or decay exp. sinusoid damped

and/or decay exp.lagafterofcuts

qpARMA

ppAR

qqMA

PACFACF

Page 22: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

22Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1• Weekly total number of loan applications

1009080706050403020101

90

80

70

60

50

Index

Applic

ations

EXEMPLO PAG 267.MPJ

The weekly data tend to have short runs and that the data seem to be indeed autocorrelated. Next, we visually inspect the stationarity. Although there might be a slight drop in the mean for the second year (weeks 53-104 ), in general it seems to be safe to assume stationarity.

Page 23: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

23Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

23

Example 5.1

2624222018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

Autocorrelation Function for Applications(with 5% significance limits for the autocorrelations)

2. It has an (or a mixture ot) exponential decay(s) pattern suggesting an AR(p) model.

1. It cuts off after lag 2 (or maybe even 3), suggesting a MA(2) (or MA(3)) model.

Page 24: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

24Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

2624222018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Partial Autocorrelation Function for Applications(with 5% significance limits for the partial autocorrelations)

24

Example 5.1

It cuts off after lag 2. Hence we use the second interpretation of the sample ACF plot and assume that the appropriate model to fit is the AR(2) model.

Page 25: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

25Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

The modified Box-Pierce test suggests that there is no autocorrelation left in the

residuals.

Page 26: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

26Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

2624222018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

2624222018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Autocorrelation Function for RESI1(with 5% significance limits for the autocorrelations)

Partial Autocorrelation Function for RESI1(with 5% significance limits for the partial autocorrelations)

Page 27: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

27Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

20100-10-20

99,9

99

90

50

10

1

0,1

Residual

Perc

ent

8075706560

20

10

0

-10

Fitted Value

Resi

dual

151050-5-10

20

15

10

5

0

Residual

Fre

quency

1009080706050403020101

20

10

0

-10

Observation Order

Resi

dual

Normal Probability Plot Versus Fits

Histogram Versus Order

Page 28: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

28Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

1009080706050403020101

90

80

70

60

50

Index

Data

ApplicationsFITS1

Variable

Page 29: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

29Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

• Dow Jones Index

80726456484032241681

12000

11000

10000

9000

8000

Index

Dow

Jones

The process shows signs of nonstationarity with

changing mean and possibly variance.

Exemplo: Página 271

Page 30: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

30Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

2018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

Autocorrelation Function for Dow Jones(with 5% significance limits for the autocorrelations)

The slowly decreasing sample ACF and sample PACF with significant value at lag 1, which is close to 1 confirm that indeed

the process can be deemed nonstationary.

Page 31: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

31Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

2018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Partial Autocorrelation Function for Dow Jones(with 5% significance limits for the partial autocorrelations)

Example 5.2

One might argue that the significant sample PACF value at lag I suggests that the AR( I) model might also fit the data well. We will consider this interpretation first and fit an AR( I) model to the Dow Jones Index data.

Page 32: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

32Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

The modified Box-Pierce test suggests that there is no autocorrelation left in the residuals. This is also confirmed by the sample ACF and PACF plots of the residuals

Page 33: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

33Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

2018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

2018161412108642

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Autocorrelation Function for RESI1(with 5% significance limits for the autocorrelations)

Partial Autocorrelation Function for RESI1(with 5% significance limits for the partial autocorrelations)

Page 34: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

34Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

10005000-500-1000

99,9

99

90

50

10

1

0,1

Residual

Perc

ent

110001000090008000

1000

500

0

-500

-1000

Fitted Value

Resi

dual

8004000-400-800-1200

20

15

10

5

0

Residual

Fre

quency

80706050403020101

1000

500

0

-500

-1000

Observation Order

Resi

dual

Normal Probability Plot Versus Fits

Histogram Versus Order

Residual Plots for Dow Jones

Example 5.2

The only concern in the residual plots in is in the changing variance observed in the time series plot of the residuals.

Page 35: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

35Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 36: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

36Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 37: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

37Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 38: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

38Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 39: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

39Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.3

1009080706050403020101

90

80

70

60

50

Week

Applic

ations

Prediction with AR(2)

Exemplo pag 278

Page 40: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

40Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.3

1101009080706050403020101

90

80

70

60

50

Time

Applic

ations

Time Series Plot for Applications(with forecasts and their 95% confidence limits)

Page 41: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

41Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.3

Page 42: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

42Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5• U.S. Clothing Sales Data

ago-03jun-02abr-01fev-00dez-98out-97ago-96jun-95abr-94fev-93jan-92

17500

15000

12500

10000

7500

5000

Date

Sale

s

The data obviously exhibit some seasonality and upward linear trend. c

Exemplo: Página 283

Page 43: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

43Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

35302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

Autocorrelation Function for Sales(with 5% significance limits for the autocorrelations)

The sample ACF and PACF indicate a monthly seasonality, s = 12, as ACF values at lags 12, 24, 36 are significant and slowly decreasing

Page 44: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

44Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

35302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

Autocorrelation Function for Sales(with 5% significance limits for the autocorrelations)

The sample ACF and PACF indicate a monthly seasonality, s = 12, as ACF values at lags 12, 24, 36 are significant and slowly decreasing

Page 45: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

45Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

35302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Partial Autocorrelation Function for Sales(with 5% significance limits for the partial autocorrelations)

Example 5.5

There is a significant PACF value at lag 12 that is close to 1. Moreover, the slowly decreasing ACF in general also indicates a nonstationarity that can be remedied by taking the first difference. Hence we would now consider

Page 46: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

46Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 47: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

47Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

35302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Partial Autocorrelation Function for Sales(with 5% significance limits for the partial autocorrelations)

Example 5.5

There is a significant PACF value at lag 12 that is close to 1. Moreover, the slowly decreasing ACF in general also indicates a nonstationarity that can be remedied by taking the first difference. Hence we would now consider

Page 48: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

48Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

ago-03jun-02abr-01fev-00dez-98out-97ago-96jun-95abr-94fev-93jan-92

1500

1000

500

0

-500

-1000

Date

Com

p D

if

Figure shows that first difference together with seasonal differencing helps in terms of stationarity and eliminating the seasonality

Page 49: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

49Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

Autocorrelation Function for Comp Dif(with 5% significance limits for the autocorrelations)

Page 50: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

50Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Partial Autocorrelation Function for Comp Dif(with 5% significance limits for the partial autocorrelations)

The sample ACF with a significant value at lag 1 and the sample PACF with exponentially decaying values at the first 8 lags suggest that a nonseasonal MA( I) model should be used.

Page 51: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

51Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

The interpretation of the remaining seasonality is a bit more difficult. For that we should focus on the sample ACF and PACF values at lags 12. 24, 36, and so on. The sample ACF at lag 12 seems to be significant and the sample PACF at lags 12, 24, 36 (albeit not significant) seems to be alternating in sign. That suggests that a seasonal MA(1) model can be used as well. Hence an ARIMA (0, 1, 1) x (0, 1, 1) 12 model is used to model the data, yt

Page 52: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

52Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 53: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

53Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Both MA( 1) and seasonal MA( 1) coefficient estimates are significant.

As we can see from the sample ACF and PACF plots, while there are still some small significant values, as indicated by the modified Box-Pierce statistic, most of the autocorrelation is now modeled out.

Page 54: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

54Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Auto

corr

ela

tion

302520151051

1,0

0,8

0,6

0,4

0,2

0,0

-0,2

-0,4

-0,6

-0,8

-1,0

Lag

Part

ial A

uto

corr

ela

tion

Autocorrelation Function for RESI1(with 5% significance limits for the autocorrelations)

Partial Autocorrelation Function for RESI1(with 5% significance limits for the partial autocorrelations)

As we can see from the sample ACF and PACF plots, while there are still some small significant values, as indicated by the modified Box-Pierce statistic, most of the autocorrelation is now modeled out.

Page 55: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

55Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

10005000-500-1000

99,9

99

90

50

10

1

0,1

Residual

Perc

ent

18000150001200090006000

500

0

-500

-1000

Fitted Value

Resi

dual

6003000-300-600-900

20

15

10

5

0

Residual

Fre

quency

140

130

120

110

1009080706050403020101

500

0

-500

-1000

Observation Order

Resi

dual

Normal Probability Plot Versus Fits

Histogram Versus Order

Page 56: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

56Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

15614413212010896847260483624121

20000

17500

15000

12500

10000

7500

5000

Time

Sale

s

Time Series Plot for Sales(with forecasts and their 95% confidence limits)

Page 57: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

57Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Introduction

Exponential smoothing. The general assumption for these models was that any time series data can be represented as the sum of two distinct components: deterministic and stochastic (random). The former (deterministic) is modeled as a function of time whereas for the latter (stochastic) we assumed that some random noise that is added on the deterministic signal generates the stochastic behavior of the time series.

One very important assumption is that the random noise is generated through independent shocks to the process.

In practice, however, this assumption is often violated. That is, usually successive observations show serial dependence. Under these circumstances, forecasting methods based on exponential smoothing may be inefficient and sometimes inappropriate because they do not take advantage of the serial dependence in the observations in the most effective way.

To formally incorporate this dependent structure, we will explore a general class of models called autoregressive integrated moving average models or ARIMA models (also known as Box-Jenkins models).

Page 58: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

58Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Linear Models for Stationary Time Series

• A linear filter is defined as

is said to be

Um conceito de Processamento

de Sinais

Page 59: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

59Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Stationarity

Page 60: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

60Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 61: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

61Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Stationary Time Series

• Many time series do not exhibit a stationary behavior

• The stationarity is in fact a rarity in real life

• However it provides a foundation to build upon since (as we will see later on) if the time series in not stationary, its first difference (yt-yt-1) will often be

Page 62: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

62Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Linear Filter

Page 63: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

63Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

If Input is White Noise

Page 64: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

64Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Using the Backshift Operator

Page 65: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

65Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Wold’s Decomposition Theorem

• Any nondeterministic weakly stationary time series can be written as an infinite sum of weighted random shocks (disturbances)

0iitity

0

2

ii

where

Page 66: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

66Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

How useful is this?

Well, not so much!!!

How can we come up with “infinitely” many terms?

Page 67: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

67Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Maybe we should consider some special cases:

Page 68: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

68Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Finite Order Moving Average Processes (Ma(q))

Page 69: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

69Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Properties

• Expected Value

• Variance

Page 70: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

70Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Properties

• Autocovariance Function

• Autocorrelation Function (ACF)

Page 71: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

71Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Autocorrelation Function of MA(q)

• ACF of Ma(q) ”cuts off” after lag q

• This is very useful in the identification of an MA(q) process

Page 72: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

72Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example

Employ.mtw

Page 73: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

73Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Diferences

Page 74: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

74Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Because you did not specify the lag length, autocorrelation uses the default length of n / 4 for a series with less than or equal to 240 observations. Minitab generates an autocorrelation function (ACF) with approximate a = 0.05 critical bands for the hypothesis that the correlations are equal to zero.

The graphs for the autocorrelation function (ACF) of the ARIMA residuals include lines representing two standard errors to either side of zero. Values that extend beyond two standard errors are statistically significant at approximately a = 0.05, and show evidence that the model does not explain thel autocorrelation in the data.

Autocorrelation

Page 75: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

75Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The ACF for these data shows large positive, significant spikes at lags 1 and 2 with subsequent positive autocorrelations that do not die off quickly. This pattern is typical of an autoregressive process.

Autocorrelation

Page 76: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

76Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Ljung-Box q statisticUse to test whether a series of observations over time are random and independent. If observations are not independent, one observation may be correlated with another observation k time units later, a relationship called autocorrelation. Autocorrelation can impair the accuracy of a time-based predictive model, such as time series plot, and lead to misinterpretation of the data.For example, an electronics company tracks monthly sales of batteries for five years. They want to use the data to develop a  time series model to help forecast future sales. However, monthly sales may be affected by seasonal trends. For example, every year a rise in sales occurs when people buy batteries for Christmas toys. Thus a monthly sales observation in one year could be correlated with a monthly sales observations 12 months later (a lag of 12). Before choosing their time series model, they can evaluate autocorrelation for the monthly differences in sales. The Ljung-Box Q (LBQ) statistic tests the null hypothesis that autocorrelations up to lag k equal zero (i.e., the data values are random and independent up to a certain number of lags--in this case 12). If the LBQ is greater than a specified critical value, autocorrelations for one or more lags may be  significantly different from zero, suggesting the values are not random and independent over time.LBQ is also used to evaluate assumptions after fitting a time series model, such as ARIMA, to ensure that the residuals are independent.The Ljung-Box is a Portmanteau test and is a modified version of the Box-Pierce chi-square statistic.

Page 77: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

77Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

You can use the Ljung-Box Q (LBQ) statistic to test the null hypothesis that the autocorrelations for all lags up to lag k equal zero. Let's test that all autocorrelations up to a lag of 6 are zero. The LBQ statistic is 56.03.

Ho: Autocorrelation (lag<6) = 0

Variable CumProb is created

Page 78: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

78Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Page 79: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

79Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

In this example, the p-value is 0.000000, which means the p-value is less than 0.0000005. The very small p-value implies that one or more of the autocorrelations up to lag 6 can be judged as significantly different from zero at any reasonable a level.

Page 80: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

80Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial autocorrelation computes and plots the partial autocorrelations of a time series. Partial autocorrelations, like autocorrelations, are correlations between sets of ordered data pairs of a time series. As with partial correlations in the regression case, partial autocorrelations measure the strength of relationship with other terms being accounted for. The partial autocorrelation at a lag of k is the correlation between residuals at time t from an autoregressive model and observations at lag k with terms for all intervening lags present in the autoregressive model. The plot of partial autocorrelations is called the partial autocorrelation function or PACF. View the PACF to guide your choice of terms to include in an ARIMA model.

Page 81: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

81Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

You obtain a partial autocorrelation function (PACF) of the food industry employment data, after taking a difference of lag 12, in order to help determine a likely ARIMA model.

Page 82: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

82Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Minitab generates a partial autocorrelation function with critical bands at approximately a = 0.05 for the hypothesis that the correlations are equal to zero. In the food data example, there is a single large spike of 0.7 at lag 1, which is typical of an autoregressive process of order one. There is also a significant spike at lag 9, but you have no evidence of a nonrandom process occurring there.

Page 83: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

83Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Page 84: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

84Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Sample ACF

• Will not be equal to zero after lag q for an MA(q)

• But it will be small

• For the same size of N, this can be tested using the limits:

N2

Page 85: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

85Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

First-Order Moving Average Process MA(1)

for which autocovariance and autocorrelation functions are given as

Page 86: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

86Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Note, the behaviorof sample ACF

Page 87: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

87Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Second-Order Moving Average Process MA(2)

for which autocovariance and autocorrelation functions are given as

Page 88: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

88Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

An Example

Page 89: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

89Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Finite Order Autoregressive Processes (AR(p))

• MA(q) processes take into account disturbances up to q lags in the past

• What if all past disturbances have some lingering effects? Back to square one?

• We may be able to come up with some special cases though

Page 90: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

90Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

A very special case

• What if we let

1for jj

Page 91: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

91Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Decomposition

10 iit

it

iit

ity

and

11

011

iit

it

iit

ity

Page 92: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

92Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Combining the two equations

t

iit

i

iit

itt yy

01

01

ttt ayy 1

This is an AR(1) model

Page 93: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

93Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

First-Order Autoregressive Process (AR(1))

ttt ayy 1

Page 94: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

94Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Properties

• Expected Value

• Autocovariance Function

• Autocorrelation Function

Page 95: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

95Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 96: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

96Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Second-Order Autoregressive Process (AR(2))

Page 97: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

97Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Conditions for Stationarity

t

t

B

t

tt

tt

tttt

B

BBy

yB

yBB

yyy

11

221

2211

1

Page 98: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

98Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(2) is stationary if …

0

aswritecanwei

iiBB

1

11

1Since

2211

2021120110

221021

jjjj B

BB

BBBB

BB

Page 99: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

99Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(2) is stationary if …

20

0

0

1

2211

02112

011

0

jjjj

Page 100: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

100Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(2)

• Hence {j} satisfy the 2nd order linear difference equation. So the i can be expressed as the solution to this equation in terms of the 2 roots m1 and m2 of the associated polynomial

• If the roots m1 and m2 satisfy

0212 mm

021 then1,

jjmm

jjj mcmcrealaremmge 221121 then,..

Page 101: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

101Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(2) is stationary if the roots m1 and m2

of are both less than

one in absolute value

0212 mm

Page 102: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

102Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of a stationary AR(2)

00

021

,,,

,

,

2

21

2211

2211

kif

kifkk

yCovyyCovyyCov

yyyCov

yyCovk

kttkttktt

ktttt

ktt

Page 103: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

103Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of a stationary AR(2)

,2,121

,2,121

210

21

21

221

kkkk

kkkk

Yule-WalkerEquations

Page 104: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

104Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of a stationary AR(2)

• Hence ACF satisfies the 2nd order linear difference equation. So the (k) can be expressed as the solution to this equation in terms of the 2 roots m1 and m2 of the associated polynomial

0212 mm

Page 105: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

105Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of a stationary AR(2)

Page 106: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

106Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 107: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

107Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(p)

p

p

tt

t

p

iitit

BBBB

yB

yy

221

1

1where

Page 108: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

108Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

AR(p) is Stationary

• If the roots of

are less than one in absolute value.

022

11

pppp mmm

Page 109: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

109Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Infinite MA representation

Page 110: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

110Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Expected Value of an AR(p)

Page 111: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

111Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Autocovariance Function of an AR(p)

Page 112: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

112Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Autocorrelation Function of an AR(p)

Page 113: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

113Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of AR(p)

,2,11

kikkp

ii

In general ACF of AR(p) can be a mixtureof exponential decay and damped sinusoidal behavior depending on the solution to the corresponding Yule-Walker equations.

Page 114: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

114Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF of AR(p)

Page 115: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

115Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF for AR(p) and MA(q)

• ACF of MA(q) “cuts off” after q

• ACF of AR(p) can be a mixture of exponential decay and damped sinusoidal

qk

qkk

q

qkqkk

y

,,0

01 22

22

1

11

Page 116: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

116Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

So how are we going to determine p in the AR(p)

model?

Page 117: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

117Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Correlation

• Suppose X, Y and Z are random variables. We define the notion of partial correlation between X and Y adjusting for Z.

• First consider simple linear regression of X on Z

• Also the linear regression of Y on Z

ZVar

XZCovbZbaX

,whereˆ

111

ZVar

YZCovbZbaY

,whereˆ

222

Page 118: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

118Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Correlation

• Now consider the errors

• Then the partial correlation between X and Y, adjusting for Z, is

ZbaYYYY

ZbaXXXX

22*

11*

ˆ

ˆ

YYXXcorrYXcorr ˆ,ˆ, **

Page 119: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

119Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Autocorrelation Function (PACF)

Page 120: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

120Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Autocorrelation Function (PACF)

Page 121: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

121Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Autocorrelation Function (PACF)

Page 122: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

122Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Partial Autocorrelation Function (PACF)

Page 123: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

123Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Sample Partial Autocorrelation Function

Page 124: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

124Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 125: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

125Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

PACF

• For an AR(p) process, PACF cuts off after lag p.

• For an MA(q) process, PACF has an exponential decay and/or a damped sinusoid form

Page 126: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

126Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Invertibility of a MA Process

Page 127: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

127Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Invertibility of a MA Process

Page 128: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

128Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Invertibility of a MA Process

We have

Page 129: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

129Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The ACF and PACF do have very distinct and indicative properties for MA and AR models. Therefore in model identification it is strongly recommended to use both the sample ACF and PACF simultaneously

Page 130: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

130Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Mixed Autoregressive-Moving Average (ARMA(p,q)) Process

tt ByB

Page 131: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

131Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Stationarity of ARMA(p,q)

Page 132: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

132Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Invertibility of ARMA(p,q)

Page 133: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

133Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ACF and PACF of an ARMA(p,q)

• Both ACF and PACF of an ARMA(p,q) can be a mixture of exponential decay and damped sinusoids depending on the roots of the AR operator.

Page 134: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

134Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARMA Models

• For ARMA models, except for possible special cases, neither ACF nor PACF has distinctive features that would allow “easy identification”

• For this reason, there have been many additional sample functions considered to help with identification problem:– Extended sample ACF (ESACF)– Generalized sample PACF (GPACF)– Inverse ACF– Use of “canonical correlations”

Page 135: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

135Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 136: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

136Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Review of Main Characteristics of ACF and PACF

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.,

lagafterofcuts sinusoid damped

and/or decay exp. sinusoid damped

and/or decay exp.lagafterofcuts

qpARMA

ppAR

qqMA

PACFACF

Page 137: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

137Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Review of Main Characteristics of Sample ACF and PACF

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.,

for1

ˆ

for0ˆ

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.

for1

ˆ

for0ˆSampleSample

qpARMA

pkT

Var

pkEpAR

qkT

Var

qkEqMA

PACFACF

Page 138: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

138Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 139: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

139Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 140: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

140Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 141: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

141Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 142: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

142Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 143: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

143Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARIMA Models

• Process {yt} is ARIMA(p,d,q), if the dth order differences, wt=(1-B)dyt, form a stationary ARMA(p,q) process:

• Thus {yt} satisfies

ttd ByBB 1

tt BwB

Page 144: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

144Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 145: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

145Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Some Examples

Page 146: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

146Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Model Building

• Given T observations from a process, want to obtain a model that adequately represents the main features of the time series data. Model can be used for purposes of forecasting, control, …

Page 147: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

147Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

3-Stage Procedure

• STAGE 1: Model Specification or Identification– Consider issue of nonstationarity vs.

stationarity of series. Use procedures such as differencing to obtain a stationary series; say wt=(1-B)dyt

• Examine sample ACF and PACF of wt and use features of these functions to identify an appropriate ARMA model. The specification is “tentative”

Page 148: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

148Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Review of Main Characteristics of ACF and PACF

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.,

lagafterofcuts sinusoid damped

and/or decay exp. sinusoid damped

and/or decay exp.lagafterofcuts

qpARMA

ppAR

qqMA

PACFACF

Page 149: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

149Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Review of Main Characteristics of Sample ACF and PACF

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.,

for1

ˆ

for0ˆ

sinusoid damped

and/or decay exp.

sinusoid damped

and/or decay exp.

for1

ˆ

for0ˆSampleSample

qpARMA

pkT

Var

pkEpAR

qkT

Var

qkEqMA

PACFACF

Page 150: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

150Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

ARMA Models

• For ARMA models, except for possible special cases, neither ACF nor PACF has distinctive features that would allow “easy identification”

• For this reason, there have been many additional sample functions considered to help with identification problem:– Extended sample ACF (ESACF)– Generalized sample PACF (GPACF)– Inverse ACF– Use of “canonical correlations”

Page 151: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

151Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

3-Stage Procedure

• STAGE 2: Estimation of Parameters in Tentatively Specified Model– Method of moments– Least Squares– Maximum Likelihood

Page 152: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

152Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

3-Stage Procedure

• STAGE 3: Model Checking– Based on examining features of residuals

q

iiti

p

iititt yy

11

ˆˆˆˆˆ

Page 153: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

153Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

3-Stage Procedure

• STAGE 3: If the specified model is appropriate order p, q; then we expect the residuals behave similar to the “true” white noise t.

Page 154: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

154Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

• Weekly total number of loan applications

Page 155: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

155Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

155

Example 5.1

Page 156: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

156Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

Page 157: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

157Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

Page 158: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

158Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

Page 159: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

159Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

Page 160: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

160Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.1

Page 161: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

161Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

• Dow Jones Index

Page 162: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

162Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 163: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

163Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 164: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

164Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 165: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

165Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 166: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

166Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 167: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

167Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 168: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

168Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 169: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

169Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 170: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

170Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.2

Page 171: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

171Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Forecasting ARIMA Processes

Page 172: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

172Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Forecasting ARIMA Processes

Page 173: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

173Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The “best” forecast

Page 174: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

174Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Forecast Error

Page 175: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

175Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Prediction Intervals

Page 176: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

176Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Two Issues

Page 177: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

177Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Illustration Using ARIMA(1,1,1)

• ARIMA(1,1,1) process is given as

• Two commonly used approaches

TT ByBB 111

Page 178: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

178Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Approach 1

Page 179: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

179Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Approach 2

Page 180: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

180Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.3

Page 181: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

181Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Seasonal Processes

Page 182: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

182Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Seasonal Processes

Page 183: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

183Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Seasonal Processes

Page 184: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

184Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Seasonal Processes

Page 185: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

185Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.4

Page 186: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

186Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

• U.S. Clothing Sales Data

Page 187: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

187Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 188: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

188Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 189: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

189Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 190: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

190Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 191: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

191Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 192: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

192Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 193: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

193Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 194: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

194Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 195: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

195Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Example 5.5

Page 196: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

196Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Use ARIMA to model time series behavior and to generate forecasts. ARIMA fits a Box-Jenkins ARIMA model to a time series. ARIMA stands for Autoregressive Integrated Moving Average with each term representing steps taken in the model construction until only random noise remains. ARIMA modeling differs from the other time series methods in the fact that ARIMA modeling uses correlational techniques. ARIMA can be used to model patterns that may not be visible in plotted data.

Page 197: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

197Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The ACF and PACF of the food employment data suggest an autoregressive model of order 1, or AR(1), after taking a difference of order 12. You fit that model here, examine diagnostic plots, and examine the goodness of fit. To take a seasonal difference of order 12, you specify the seasonal period to be 12, and the order of the difference to be 1.

Page 198: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

198Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

1    Model is specified by the usual notation (pdq) x (PDQ) S: (pdq) is for a nonseasonal model; (PDQ) for a seasonal, and S is the seasonality.

2    At least one of the p, P, q, or Q parameters must be non-zero, and none may exceed five.3    The maximum number of parameters you can estimate is ten.4    At least three data points must remain after differencing. That is, S * D + d + 2 must be less than the number of points, where S is the length of a season.5    The maximum "back order" for the model is 100. In practice, this condition is always satisfied if S * D + d + p + P + q + Q is at most 100.6    The ARIMA model normally includes a constant term only if there is no differencing (that is, d = D = 0).7    Missing observations are only allowed at the beginning or the end of a series, not in the middle.8    The seasonal component of this model is multiplicative, and thus is appropriate when the amount of cyclical variation is proportional to the mean.

Page 199: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

199Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The ARIMA model converged after nine iterations. The AR(1) parameter had a t-value of 7.42. As a rule of thumb, you can consider values over two as indicating that the associated parameter can be judged as significantly different from zero. The MSE (1.1095) can be used to compare fits of different ARIMA models.The Ljung-Box statistics give nonsignificant p-values , indicating that the residuals appeared to uncorrelated. The ACF and PACF of the residuals corroborate this. You assume that the spikes in the ACF and PACF at lag 9 are the result of random events

The coefficients are estimated using an iterative algorithm that calculates least squares estimates. At each iteration, the back forecasts are computed and SSE is calculated.

Back forecasts are calculated using the specified model and the current iteration's parameter estimates

Page 200: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

200Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Box and Jenkins [2] present an interactive approach for fitting ARIMA models to time series. This iterative approach involves identifying the model, estimating the parameters, checking model adequacy, and forecasting, if desired. The model identification step generally requires judgment from the analyst.1    First, decide if the data are stationary. That is, do the data possess constant mean and variance . ·    Examine a time series plot to see if a transformation is required to give constant variance. ·    Examine the ACF to see if large autocorrelations do not die out, indicating that differencing may be required to give a constant mean.

A seasonal pattern that repeats every kth time interval suggests taking the kth difference to remove a portion of the pattern. Most series should not require more than two difference operations or orders. Be careful not to overdifference. If spikes in the ACF die out rapidly, there is no need for further differencing. A sign of an overdifferenced series is the first autocorrelation close to -0.5 and small values elsewhere.

Page 201: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

201Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

2    Next, examine the ACF and PACF of your stationary data in order to identify what autoregressive or moving average models terms are suggested. ·    An ACF with large spikes at initial lags that decay to zero or a PACF with a large spike at the first and possibly at the second lag indicates an autoregressive process. ·    An ACF with a large spike at the first and possibly at the second lag and a PACF with large spikes at initial lags that decay to zero indicates a moving average process.·    The ACF and the PACF both exhibiting large spikes that gradually die out indicates that both autoregressive and moving averages processes are present. For most data, no more than two autoregressive parameters or two moving average parameters are required in ARIMA models.

Page 202: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

202Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

3    Once you have identified one or more likely models, you are ready to use the ARIMA procedure.·    Fit the likely models and examine the significance of parameters and select one model that gives the best fit. ·    Check that the ACF and PACF of residuals indicate a random process, signified when there are no large spikes. You can easily obtain an ACF and a PACF of residual using ARIMA's Graphs subdialog box. If large spikes remain, consider changing the model.·    You may perform several iterations in finding the best model. When you are satisfied with the fit, go ahead and make forecasts.

The ARIMA algorithm will perform up to 25 iterations to fit a given model. If the solution does not converge, store the estimated parameters and use them as starting values for a second fit. You can store the estimated parameters and use them as starting values for a subsequent fit as often as necessary.

Page 203: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

203Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The graphs for the ACF and PACF of the ARIMA residuals include lines representing two standard errors to either side of zero. Values that extend beyond two standard errors are statistically significant at approximately a = 0.05, and show evidence that the model has not explained all autocorrelation in the data.

Page 204: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

204Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Page 205: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

205Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The AR(1) model appears to fit well so you use it to forecast employment.

Page 206: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

206Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Page 207: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

207Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

Page 208: 1 Previsão | Pedro Paulo Balestrassi |  5 – Autoregressive Integrated Moving Average (ARIMA) Models.

208Previsão | Pedro Paulo Balestrassi | www.pedro.unifei.edu.br

The ARIMA algorithm is based on the fitting routine in the TSERIES package written by Professor William Q. Meeker, Jr., of Iowa State University. • W.Q. Meeker, Jr. (1977). "TSERIES-A User-oriented Computer Program for Identifying, Fitting and Forecasting ARIMA Time Series Models," ASA 1977 Proceedings of the Statistical Computing Section.• W.Q. Meeker, Jr. (1977). TSERIES User's Manual, Statistical Laboratory, Iowa State University.