Presentation is loading. Please wait.

Presentation is loading. Please wait.

ARIMA 建模的步驟 Stationize: 檢測序列的平穩性,對不平穩的序列,差分轉換為平穩序列。

Similar presentations


Presentation on theme: "ARIMA 建模的步驟 Stationize: 檢測序列的平穩性,對不平穩的序列,差分轉換為平穩序列。"— Presentation transcript:

1 ARIMA 建模的步驟 Stationize: 檢測序列的平穩性,對不平穩的序列,差分轉換為平穩序列。
Tentative identification: 由資料的 acf, pacf 辨識適合的 ARMA模式, 選出數個可能模式。 Estimation: 對遴選模式估計參數 Diagnostic Checking: 由各種診斷法來檢視模式的適合性,挑選出一模式,視為用於預測的模式 Forecasting: 以最終模式預測未來值 應隨時做模式的更新。

2 Make a Stationary series
如果手中的時序資料不是 stationary,以一次差分轉換,使成為一 stationary series,必要時用多次差分。 利用檢定確認它是一 平穩序列

3 Tentative identification
由樣本的acf 及pacf 的走勢及變化來辨識ARMA模式中的 p,q值 選出數個候選模式 模式應力求簡單 Model acf Pacf MA(q) 時差 q 之後切斷 指數或正弦函數式漸漸消失 AR(p) 時差 p 之後切斷 ARMA(p,q)

4 Estimation 原則上用 least square estimate 估計的係數必滿足 平穩性及可逆性之條件
ARMA 係數的估計有時需以遞迴的數值法得解,有可能遇到不收歛情況

5 例 : 一平穩序列,分別以 AR(1), MA(1), 及 ARMA(1,1) 配適:
PACF ACF Autocorrelations Lag Correlation  6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 - |                    |********************| 1 | |*********|   .                | 2 |               .    |*   .               | 3 |               .    |    .               | 4 |              .   *|    .               | 5 6 |             .  **|    .               | 7 |               .    |**  .               | 8 9 10 |            . ***|    .               | 11 |               .    |****.               | 12 |          *****|    .               | Partial Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 |           *********|   .                | 2 |                 .***|   .                | 3 |                 .  *|   .                | 4 |               . **|   .                | 5 |                 . **|   .                | 6 |                 ****|   .                | 7 |                 .  *|   .                | 8 |                 . **|   .                | 9 |                 .   |*  .                | 10 |                 .***|   .                | 11 |                 .   |*  .                | 12 |               ****|   .               

6 No mean term in this model.
以 AR(1) 配適: Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag AR1,1 -4.89 <.0001 1 Variance Estimate Std Error Estimate AIC SBC Number of Residuals 100 Model for variable Zt No mean term in this model. Autoregressive Factors Factor 1: B**(1)

7 以 MA(1) 配適: Conditional Least Squares Estimation Parameter Estimate
Standard Error t Value Approx Pr > |t| Lag MA1,1 8.31 <.0001 1 Model for variable Zt No mean term in this model. Variance Estimate Std Error Estimate AIC SBC Number of Residuals 100 Moving Average Factors Factor 1: B**(1)

8 以 ARMA(1,1) 配適: Conditional Least Squares Estimation Parameter
Estimate Standard Error t Value Approx Pr > |t| Lag MA1,1 63.89 <.0001 1 AR1,1 3.87 0.0002 Model for variable Zt No mean term in this model. Variance Estimate Std Error Estimate AIC SBC Number of Residuals 100 Autoregressive Factors Factor 1: B**(1) Moving Average Factors Factor 1: 1 - 1 B**(1)

9 Diagnostic Checking 一個適合的模式:係數顯著、殘差為 white noise 殘差為 white noise 之檢測:
1、autocorrelation check for residual (chi-square test) H0 :ρ1= ρ2= …=ρk=0 (在 SAS 中每六個檢定一次) p-value < 0.05 ,結論為其中至少有一個不為 0 2、觀察殘差的 ACF, PACF 係數的檢測: 1、顯著性 t-test p-value < 0.05 ,結論為係數不為 0 2、共線性狀況 檢查係數的相關係數

10 AICk = n ln(SSEk) – n ln(n) + 2k SBCk = n ln(SSEk) – n ln(n) + ln(n) k
AIC, SBC 模式判定值 AICk = n ln(SSEk) – n ln(n) + 2k SBCk = n ln(SSEk) – n ln(n) + ln(n) k 此處 SSE 為誤差平方值, k 為估計參數個數 ,判定值愈小,模式愈佳。 Standard Error 標準誤 標準誤小,預測誤差小,預測區間窄 預測式的選取 先選數個模式,檢測它們的適合性,再由適合的模式中比較AIC, SBC,及相關的適合現象,最後選一最理想的做為預測式。原則上,預測式愈簡單愈好。

11 例題: 一、以 AR(1) 配適: 另由殘差的 ACF PACF 顯示 無自相關 二、以 MA(1) 配適:
Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 6.43 5 0.2663 -0.076 -0.163 -0.020 -0.105 -0.096 -0.088 12 10.35 11 0.4991 0.060 0.023 0.029 -0.062 0.062 -0.147 18 17.83 17 0.3997 0.093 -0.067 0.064 0.077 -0.141 0.135 24 24.79 23 0.3613 0.101 -0.164 0.075 -0.015 0.017 另由殘差的 ACF PACF 顯示 無自相關 二、以 MA(1) 配適: Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 8.15 5 0.1484 0.067 0.061 -0.051 -0.151 -0.141 12 13.10 11 0.2870 0.003 -0.039 0.018 -0.107 0.043 -0.167 18 19.11 17 0.3225 0.093 -0.053 0.081 0.097 -0.074 0.129 24 24.51 23 0.3761 0.035 -0.078 -0.169 0.022 -0.073 0.004 另由殘差的 ACF PACF 顯示 無自相關

12 三、以 ARMA(1,1) 配適: 另由殘差的 ACF PACF 顯示 無自相關 共線性現象微弱
Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 4.61 4 0.3297 -0.079 0.158 0.057 -0.037 -0.021 -0.088 12 12.81 10 0.2343 0.051 -0.044 0.042 -0.127 0.090 -0.203 18 21.03 16 0.1773 0.126 -0.099 0.062 -0.124 0.123 24 26.35 22 0.2371 0.006 -0.055 -0.158 0.059 -0.093 0.027 另由殘差的 ACF PACF 顯示 無自相關 Correlations of Parameter Estimates Parameter MA1,1 AR1,1 1.000 0.117 共線性現象微弱

13 在此三模式中,MA(1) 最適合資料,選定預測式為 Yt = εt – 0.646 εt-1 , S = 1.054
三模式比較 參數顯著性 Is residual white noise? Std Error AIC, SBC Model_1 AR(1) 顯著 Yes 1.089 302, 304 Model_2 MA(1) 1.054 295, 298 Model_3 ARMA(1,1) 顯著,但有一估計值為 1,不滿足可逆性 1.007 287, 292 在此三模式中,MA(1) 最適合資料,選定預測式為 Yt = εt – εt-1 , S = 1.054

14 Case Study – DVD weekly sale series
原始資料序列 Step 1、平穩性檢測 Step 2、遴選模式及診斷 Step 3、預測

15 Step 1.1、平穩性檢測 原始資料非平穩序列 Dickey-Fuller Unit Root Tests Type Lags Rho
Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 Std Error |                    |********************| 1 |                 .  |******************* | 0.07 2 |               .    |******************* | 0.13 3 |             .      |******************  | 0.16 4 |            .       |*****************   | 0.19 5 |           .        |****************    | 0.21 6 |          .         |****************    | 0.23 7 0.25 8 |         .          |***************     | 0.26 9 0.28 10 |        .           |***************     | 0.29 Dickey-Fuller Unit Root Tests Type Lags Rho Pr < Rho Tau Pr < Tau F Pr > F Zero Mean 0.4544 0.7937 0.78 0.8800 Single Mean 0.7812 -0.84 0.8051 0.87 0.8489 Trend 0.5030 -2.18 0.4962 2.49 0.6796 原始資料非平穩序列

16 Step 1.2、差分一次,平穩性檢測 一次差分資料為平穩序列 Dickey-Fuller Unit Root Tests Type
Autocorrelations Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 Std Error |                    |********************| 1 |                 .  |*********           | 2 |                .   |   .                | 3 4 5 |               *****|   .                | 6 |             *******|   .                | 7 |                . **|   .                | 8 |                .  *|   .                | Dickey-Fuller Unit Root Tests Type Lags Rho Pr < Rho Tau Pr < Tau F Pr > F Zero Mean <.0001 -7.76 Single Mean 0.0012 -7.78 30.26 0.0010 Trend 0.0005 30.13 一次差分資料為平穩序列

17 Step 2、遴選模式及診斷 (設定平均數為 0) 觀察 ACF, PACF; r1>0 r6>0 acf dies down
r11>0 r22> pacf dies down PACF Partial Autocorrelations Lag Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 1 |                 .  |*********           | 2 |               *****|  .                 | 3 |                 .  |***                 | 4 |                 .**|  .                 | 5 6 |                 ***|  .                 | 7 |                 .  |**.                 | 8 9 |                 .  |* .                 | 10 |                 . *|  .                 | 11 |                 .  |  .                 | 12 儲選模式一:AR(1) or ARMA(1,1)

18 Step 2.1、模式1 AR(1) AR(1) 配適結果,殘差仍有自相關現象 Autoregressive Factors
B**(1) Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag AR1,1 6.19 <.0001 1 Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 32.93 5 <.0001 0.104 -0.244 0.029 0.107 -0.165 -0.297 12 37.32 11 0.0001 0.058 0.007 -0.073 -0.028 0.069 0.105 18 40.89 17 0.0010 0.063 0.028 0.031 -0.113 -0.037 24 48.93 23 0.0013 0.040 -0.092 -0.054 0.144 -0.091 30 53.69 29 0.0035 0.100 0.116 -0.030 -0.017 -0.006 0.003 AR(1) 配適結果,殘差仍有自相關現象

19 Step 2.2、模式2 ARMA(1,1) ARMA(1,1) 配適結果,殘差仍有自相關現象,在 k=6
Autoregressive Factors Factor 1: B**(1) Moving Average Factors Factor 1: B**(1) Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 18.23 4 0.0011 0.000 -0.006 -0.009 0.045 -0.131 -0.299 12 22.07 10 0.0148 0.054 -0.075 -0.034 -0.032 0.072 0.080 18 27.56 16 0.0356 0.084 0.061 -0.132 0.002 -0.049 24 32.62 22 0.0675 0.039 -0.081 -0.043 0.112 0.031 -0.059 30 36.71 28 0.1253 0.092 0.093 0.015 Autocorrelation Plot of Residuals Lag Covariance Correlation -1 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 1 Std Error |                    |********************| 1 |                 .  |  .                 | 2 3 4 |                 .  |* .                 | 5 |                 ***|  .                 | 6 |              ******|  .                 | 7 ARMA(1,1) 配適結果,殘差仍有自相關現象,在 k=6

20 Step 2.3、模式3 AR with B,B^6, MA with B
Autoregressive Factors Factor 1: B**(1) B**(6) Moving Average Factors Factor 1: B**(1) Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag MA1,1 -5.57 <.0001 1 AR1,1 -0.24 0.8103 AR1,2 -4.06 6 Correlations of Parameter Estimates Parameter MA1,1 AR1,1 AR1,2 1.000 0.752 -0.139 -0.010 Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 3.38 3 0.3367 0.015 -0.015 -0.025 0.036 -0.134 -0.001 12 7.10 9 0.6270 0.079 -0.085 -0.030 -0.075 0.038 -0.013 18 14.65 15 0.4772 0.134 -0.054 0.041 -0.128 0.028 -0.051 24 20.06 21 0.5176 0.108 -0.052 -0.037 0.083 0.021 -0.077 30 24.78 27 0.5869 0.084 0.087 0.018 -0.059 -0.016 配適結果,殘差無自相關現象,AR1,1 係數不顯著

21 Step 2.4、模式4 AR with B^6, MA with B
Autoregressive Factors Factor 1: B**(6) Moving Average Factors Factor 1: B**(1) Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag MA1,1 -8.20 <.0001 1 AR1,1 -4.00 6 Correlations of Parameter Estimates Parameter MA1,1 AR1,1 1.000 -0.188 Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 3.10 4 0.5410 0.008 -0.019 -0.013 0.042 -0.127 0.000 12 6.83 10 0.7411 0.093 -0.078 -0.025 -0.066 0.044 -0.006 18 13.93 16 0.6039 0.135 -0.047 0.048 -0.119 0.035 -0.041 24 19.71 22 0.6010 0.116 -0.044 -0.030 0.094 0.028 -0.072 30 24.57 28 0.6510 0.090 -0.071 0.025 -0.050 -0.008

22 Step 2.5、模式5 AR with B, MA with B^6
Autoregressive Factors Factor 1: B**(1) Moving Average Factors Factor 1: B**(6) Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag MA1,1 3.61 0.0004 6 AR1,1 5.93 <.0001 1 Correlations of Parameter Estimates Parameter MA1,1 AR1,1 1.000 -0.118 Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 15.30 4 0.0041 0.107 -0.247 0.013 0.032 -0.135 -0.029 12 21.41 10 0.0184 0.110 -0.053 -0.073 -0.051 0.029 0.108 18 25.61 16 0.0598 0.117 -0.007 -0.004 -0.094 -0.031 0.005 24 32.99 22 0.0620 0.101 -0.058 -0.067 0.111 0.018 30 38.56 28 0.0883 0.112 -0.010 -0.017

23 Step 2.6、模式6 MA(2) with B & B^6 Moving Average Factors Factor 1:
Conditional Least Squares Estimation Parameter Estimate Standard Error t Value Approx Pr > |t| Lag MA1,1 -11.13 <.0001 1 MA1,2 5.91 6 Correlations of Parameter Estimates Parameter MA1,1 MA1,2 1.000 0.682 Autocorrelation Check of Residuals To Lag Chi-Square DF Pr > ChiSq Autocorrelations 6 2.24 4 0.6912 0.011 -0.004 -0.001 0.015 -0.107 -0.039 12 5.87 10 0.8263 -0.069 0.006 -0.058 -0.044 0.051 0.091 18 9.52 16 0.8905 0.067 0.034 0.004 0.033 -0.045 24 14.69 22 0.8751 0.057 -0.026 -0.070 0.108 0.046 30 20.07 28 0.8618 0.115 0.081 -0.053 -0.063 -0.011

24 Step 2.7、Summary 選擇 Model 6為預測式 參數 Is residual white noise? Std Error
AIC, SBC Model_1 AR(1) 顯著 No 2.54 753.6, 756.7 Model_2 ARMA(1,1) 2.45 743.9, 753.2 Model_3 AR: B, B^6 MA: B AR_B 不顯著 Yes 2.336 729.5, 741.8 Model_4 AR: B^6 MA: B 2.330 726.7, 732.8 Model_5 AR: B MA: B^6 yes 2.440 741.4, 747.6 Model_6 MA: B,B^6 2.278 719.7, 725.9 選擇 Model 6為預測式

25 Step 3 預測式 Sample mean = 59.3

26 預測 – 未來10星期的預測區間 Forecasts for variable y Obs Forecast Std Error
95% Confidence Limits 162 2.2797 163 4.3242 164 5.6745 165 6.7602 166 7.6943 167 8.5266 168 9.0182 169 9.4843 170 9.9286 171

27


Download ppt "ARIMA 建模的步驟 Stationize: 檢測序列的平穩性,對不平穩的序列,差分轉換為平穩序列。"

Similar presentations


Ads by Google