binh, p.t. 2013. lecture 5. arima models

33
AutoRegressive Integrated Moving Average Dự báo và Phân tích dữ liệu (12/11/2013) Phùng Thanh Bình ptbinh[a-còng]ueh.edu.vn

Upload: nguyentai325

Post on 26-Dec-2015

6 views

Category:

Documents


0 download

DESCRIPTION

ARMA

TRANSCRIPT

Page 1: Binh, P.T. 2013. Lecture 5. ARIMA Models

AutoRegressive Integrated

Moving Average

Dự báo và Phân tích dữ liệu

(12/11/2013)

Phùng Thanh Bình

ptbinh[a-còng]ueh.edu.vn

Page 2: Binh, P.T. 2013. Lecture 5. ARIMA Models

NỘI DUNG

Giới thiệu

Phương pháp luận Box-Jenkins

Mô hình AR(p)

Mô hình MA(q)

Mô hình ARMA(p,q)

Mô hình ARIMA(p,d,q)

Mô hình SARIMA

Ví dụ minh họa

Page 3: Binh, P.T. 2013. Lecture 5. ARIMA Models

Ln(Yt)

Stationary Seasonal

Yt

Nonstationary

p, q

AR(p)

MA(q)

ARMA(p,q)

Practical

ARMA(p,q)

Diagnostic Checking

∆LnYt

Stationary

NonStationary

∆2LnYt

Seasonal

difference

p, q, P, Q

Holt-

Winters

SARIMA

Comparison

BOX-JENKINS

METHODOLOGY

Page 4: Binh, P.T. 2013. Lecture 5. ARIMA Models

Step 1 Calculate the ACF and PACF of the raw data, and check whether the

series is stationary or not. If the series is stationary go to step 3,

if not go to step 2.

Step 2 Take the log and the 1st diff.of the raw data and calculate the ACF and

PACF for the first logarithic differenced series.

Step 3 Examine the graphs of the ACF and PACF and determine which models would

be good starting points.

Step 4 Estimate those models.

Step 5 Diagnostic checking for each of these estimated models:

a) Check to see if the parameter of the longest lag is significant. If

not, then you probably have too many parameters, and should decrease

the order of p and/or q.

b) Check the ACF and PACF of the errors. If the model has at least

enough parameters, then all ACFs and PACFs will be insignificant.

c) Check the AIC and SBC together with the adj-R2 of the estimated

models to detect which model is the parsimonious one (i.e., the one

that minimizes AIC and SBC and has the highest adj-R2).

d) Check the RMSE and compare the fitted – actual value graphs

(especially at turning points).

If the series is highly volatile (e.g., stock prices, gold prices, and

other commodity prices), we sometimes check whether the ARCH effects

exist. If yes, we should apply the ARCH/GARCH models for the data.

Step 6 If changes in the original model are needed, go back to step 4.

BOX-JENKINS METHODOLOGY

Page 5: Binh, P.T. 2013. Lecture 5. ARIMA Models

AUTOREGRESSIVE (AR) MODEL

Giả sử Yt là một chuỗi dừng

Mô hình AR(p) có dạng sau đây:

Yt = B0 + B1Yt-1 + … + BpYt-p + ut (1)

ut: white noise error term

Độ trễ p được xác định theo lối

thực nghiệm, dựa vào các tiêu

chí như AIC, hoặc theo PACF!

PACF? Partial AutoCorrelation Function

Page 6: Binh, P.T. 2013. Lecture 5. ARIMA Models

AUTOREGRESSIVE (AR) MODEL

PACF3

Yt = b0 + b1Yt-1 + b2Yt-2 + b3Yt-3 + et (2)

Yt-3 = c0 + c1Yt-1 + c2Yt-2 + v3 (3)

Yt = a0 + b3v3 + rt (4)

PACFk

Yt = b0 + b1Yt-1 + … + bkYt-k + et (5)

Yt-k = c0 + c1Yt-1 + … + ct-k-1Yt-k-1 + vk (6)

Yt = a0 + bkvk + rt (7)

Page 7: Binh, P.T. 2013. Lecture 5. ARIMA Models

AUTOREGRESSIVE (AR) MODEL

AR(p) phù hợp với chuỗi thời

gian có dạng:

• Các hệ số tự tương quan (ACF)

giảm từ từ xuống giá trị 0;

• Các hệ số tự tương quan riêng

(PACF) sẽ giảm xuống giá trị

0 ngay sau khi độ trễ p.

Page 8: Binh, P.T. 2013. Lecture 5. ARIMA Models

AR(1)

AR(1)

AR(2)

AR(2)

Page 9: Binh, P.T. 2013. Lecture 5. ARIMA Models

MOVING AVERAGE (MA) MODEL

Giả sử Yt là một chuỗi dừng

Mô hình MA(q) có dạng sau đây:

Yt = + ut + C1ut-1 + … + Cqut-q (8)

Độ trễ q được xác định theo lối

thực nghiệm, dựa vào các tiêu

chí như AIC, hoặc theo ACF!

ACF? AutoCorrelation Function

Page 10: Binh, P.T. 2013. Lecture 5. ARIMA Models

AUTOREGRESSIVE (AR) MODEL

MA(q) phù hợp với chuỗi thời

gian có dạng:

• Các hệ số tự tương quan (ACF)

sẽ giảm xuống giá trị 0 ngay

sau khi độ trễ q; và

• Các hệ số tự tương quan riêng

(PACF) giảm từ từ xuống giá

trị 0.

Page 11: Binh, P.T. 2013. Lecture 5. ARIMA Models

MA(1)

MA(2)

MA(2)

MA(1)

Page 12: Binh, P.T. 2013. Lecture 5. ARIMA Models

AUTOREGRESSIVE MOVING

AVERAGE(ARMA) MODEL

Giả sử Yt là một chuỗi dừng

Mô hình ARMA(p,q) có dạng sau

đây [kết hợp (1) và (8)]:

Yt = A + B1Yt-1 + … + BpYt-p + ut +

C1ut-1 + … + Cqut-q (9)

Độ trễ p và q được xác định như

ở mô hình AR và MA.

Page 13: Binh, P.T. 2013. Lecture 5. ARIMA Models

TỔNG QUÁT

ACF PACF

AR(p) Decays exponentially or with damped sine wave

pattern or both

Significant spikes through lag p

MA(q) Significant spikes

through lag q

Decays exponentially or with damped sine wave

pattern or both

ARMA(p,q) Exponential decay Exponential decay

Page 14: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARMA(1,1)

Page 15: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA(p,d,q)

“Integrated of order d”?

Xác định p, d, q như thế nào?

So sánh giữa các mô hình?

Xem hệ số gắn với độ trễ xa nhất có ý

nghĩa thống kê hay không

Giản đồ tự tương quan phần dư

Các tiêu chí AIC, SIC

RMSE, MAE, …

Quan sát đồ thị, …

XÁC ĐỊNH MÔ HÌNH ARIMA THỰC TẾ?

Page 16: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA(p,d,q)

VÍ DỤ (Y là một chuỗi dừng):

• AR(2) hoặc ARMA(2,0)

ls Y c AR(1) AR(2)

• MA(3) hoặc ARMA(0,3)

ls Y c MA(1) MA(2) MA(3)

• ARMA(1,2)

ls Y c AR(1) MA(1) MA(2)

Page 17: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA(p,d,q)

VÍ DỤ (Y là một chuỗi dừng ở

sai phân bậc 1):

• ARIMA(2,1,0)

ls D(Y) c AR(1) AR(2)

• ARIMA(0,1,3)

ls D(Y) c MA(1) MA(2) MA(3)

• ARIMA(1,1,2)

ls D(Y) c AR(1) MA(1) MA(2)

Page 18: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA(p,d,q)

VÍ DỤ [log(Y) là một chuỗi dừng ở

sai phân bậc 1]:

• ARIMA(2,1,0)

ls D(log(Y)) c AR(1) AR(2)

• ARIMA(0,1,3)

ls D(log(Y)) c MA(1) MA(2) MA(3)

• ARIMA(1,1,2)

ls D(log(Y)) c AR(1) MA(1) MA(2)

Page 19: Binh, P.T. 2013. Lecture 5. ARIMA Models

SARIMA(p,d,q;P,Q)

Dữ liệu tháng: P = 12, Q = 12

Dữ liệu quý: P = 4, Q = 4

VÍ DỤ (Y là chuỗi dừng, theo

quý):

• SARIMA(2,0,0;4,0)

ls Y c AR(1) AR(2) SAR(4)

• SAMRIA(0,0,3;4,4)

ls Y c MA(1) MA(2) MA(3) SAR(4) SMA(4)

Page 20: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA thực tế

VÍ DỤ (Y là chuỗi dừng, p = 3,

7, 15; q = 1, 5, 15)

ls Y c AR(3) AR(7) AR(15)

MA(1) MA(5) MA(15) (10)

Giả sử hệ số của MA(15) không có ý

nghĩa thống kê, và hệ số ACF7 ≠ 0, và

PACF5 ≠ 0), ta ước lượng lại như sau:

ls Y c AR(3) AR(5) AR(7) AR(15)

MA(1) MA(5) MA(7) (11)

Page 21: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARIMA thực tế

VÍ DỤ (tt)

Sau khi ước lượng (11), ta

phải so sánh AIC và/hoặc

MRSE giữa (10) và (11),

nếu mô hình (11) có AIC

nhỏ hơn thì mô hình (11)

tốt hơn mô hình (10).

Page 22: Binh, P.T. 2013. Lecture 5. ARIMA Models

VÍ DỤ (Table 13-6, Gujarati, 2011)

40

60

80

100

120

140

00M01 00M07 01M01 01M07 02M01 02M07

CLOSE

Page 23: Binh, P.T. 2013. Lecture 5. ARIMA Models

CLOSE

Page 24: Binh, P.T. 2013. Lecture 5. ARIMA Models

D(CLOSE)

Page 25: Binh, P.T. 2013. Lecture 5. ARIMA Models

D(CLOSE)

Page 26: Binh, P.T. 2013. Lecture 5. ARIMA Models

Sai số chuẩn = SQRT(1/739) =

0.037 (Bartlett)

Khoảng tin cậy 95% sẽ là [-

0.0725, 0.0725]

Các hệ số ACF sau đây khác 0:

4, 18, 22, 35, 43

Các hệ số PACF sau đây khác

0: 4, 18, 22, 26

VÍ DỤ (Gujarati, 2011)

Page 27: Binh, P.T. 2013. Lecture 5. ARIMA Models

AR model

Page 28: Binh, P.T. 2013. Lecture 5. ARIMA Models

MA model

Page 29: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARMA model 1

Page 30: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARMA model 2

Page 31: Binh, P.T. 2013. Lecture 5. ARIMA Models

ARMA model 3

Page 32: Binh, P.T. 2013. Lecture 5. ARIMA Models

40

60

80

100

120

140

2000M07 2001M01 2001M07 2002M01 2002M07

CLOSEF ± 2 S.E.

Forecast: CLOSEFActual: CLOSEForecast sample: 1/03/2000 10/31/2002Adjusted sample: 2/22/2000 8/26/2002Included observations: 651

Root Mean Squared Error 2.490895Mean Absolute Error 1.851397Mean Abs. Percent Error 1.860668Theil Inequality Coefficient 0.012043 Bias Proportion 0.000000 Variance Proportion 0.000991 Covariance Proportion 0.999009

Page 33: Binh, P.T. 2013. Lecture 5. ARIMA Models

-80

-40

0

40

80

120

160

200

00M07 01M01 01M07 02M01 02M07

CLOSEF ± 2 S.E.

Forecast: CLOSEFActual: CLOSEForecast sample: 1/03/2000 10/31/2002Adjusted sample: 2/22/2000 10/31/2002Included observations: 651

Root Mean Squared Error 21.33488Mean Absolute Error 17.31010Mean Abs. Percent Error 16.17322Theil Inequality Coefficient 0.112427 Bias Proportion 0.626384 Variance Proportion 0.014538 Covariance Proportion 0.359078