Time Series Final Review
Time Series Final Review
R-sq: coefficient of determination, ...% of variability in Y that can be explained through knowledge
of the variability in the variable X.
R-sq = Explained var / Total var = SSR / SST
= 1 – Unexplained var / Total var = 1 – SSE/SST
R-sq = correlation^2
𝑛−1
Adjusted R-square: ̅𝑅̅̅2̅ = 1 − (1 − 𝑅2 ) ( )
𝑛−𝑘−1
Final Time Series
Noted by Mỹ Dung K20 Logistics
3. Hypothesis testing
i. F-test for significance of regression (test nguyên model)
𝐻0 : 𝛽1 = ⋯ = 𝛽𝑘 = 0
𝐻1 : at least one 𝐵𝑗 ≠ 0
F-ratio: MSR/MSE
Critical value: 𝐹(𝛼, 𝑑𝑓1 : 𝑘, 𝑑𝑓2 : 𝑛 − 𝑘 − 1)
Make decision: Reject 𝐻0 if F-ratio > critical value => model bth
4. Multicollinearity
Tìm xem các independent variable X có mối quan hệ tuyến tính với nhau hay không, vì nếu có thì sẽ ảnh
hưởng đến model và cần xử lý (vì trong một multi-regression model thì các independent X nên
independent!)
Mối quan hệ ở đây được thể hiện thông qua giá trị VIF, ngoài ra nó có thể thể hiện thông qua giá trị
correlation giữa các X với nhau (nếu X có correlation cao so với các X còn lại => cần xử lý/remove X đó)
Example:
There is 4 variables
For each var, we set up it as the dependent variable (Y), with the independent variables (X) are the
other variables
Var 1 = 𝛽0 + 𝛽1 Var 2 + 𝛽2 Var 3 + 𝛽3 Var 4 => find R_sq
Var 2 = 𝛽0 + 𝛽1 Var 3 + 𝛽2 Var 4 + 𝛽3 Var 1 => find R_sq
Var 3 = 𝛽0 + 𝛽1 Var 4 + 𝛽2 Var 1 + 𝛽3 Var 2 => find R_sq
Var 4 = 𝛽0 + 𝛽1 Var 1 + 𝛽2 Var 2 + 𝛽3 Var 3 => find R_sq
1
𝑉𝐼𝐹1 = = 4
1 − 0.75
Final Time Series
Noted by Mỹ Dung K20 Logistics
𝑦𝑡 = 𝛽0 + 𝛽1 𝑥𝑡 + 𝜀𝑡
𝜀𝑡 = 𝜌𝜀𝑡−1 + 𝜐𝑡
Hypothesis
𝐻0 : 𝜌 = 0
𝐻1 : 𝜌 > 0
Test-statistic
∑𝑛𝑡=2(𝑒𝑡 − 𝑒𝑡−1 )2
𝐷𝑊 =
∑𝑛𝑡=1 𝑒𝑡2
Or
𝐷𝑊 = 2(1 − 𝑟1 (𝑒))
∑𝑛𝑡=2 𝑒𝑡 𝑒𝑡−1
𝑟1 (𝑒) =
∑𝑛𝑡=1 𝑒𝑡2
Critical value:
Appendix, table 6. Xác định 𝛼, n và k (n là sample size, k là số lượng independent variables X)
Make decision:
If 𝐷𝑊 > 𝑑𝑈 , conclude 𝐻0 : 𝜌 = 0 => error is independent / random
If 𝐷𝑊 < 𝑑𝐿 , conclude 𝐻1 : 𝜌 ≠ 0 => error is not independent/ random
If 𝑑𝐿 ≤ 𝐷𝑊 ≤ 𝑑𝑈 : the test is inconclusive
𝐻0 : 𝜌 = 0
𝐻1 : 𝜌 > 0
𝐷𝑊 = 2(1 − 𝑟1 (𝑒)) = 2(1 − (−0.67)) = 3.34
Critical value: alpha = 5%, n = 6, k = 1
𝑑𝐿 = 0.61 𝑑𝑈 = 1.40
Make decision: 𝑑𝑈 < 𝐷𝑊 => 𝐻0 : 𝜌 = 0
(Correlation is not significantly different from 0) => error is not random
Final Time Series
Noted by Mỹ Dung K20 Logistics
Final Time Series
Noted by Mỹ Dung K20 Logistics
Final Time Series
Noted by Mỹ Dung K20 Logistics
CHAPTER 8: ARIMA
1. Introduction (p, d, q) & cut off, die out
AR p: 𝑌𝑡 = 𝜙0 + 𝜙1 𝑌𝑡−1 + 𝜙2 𝑌𝑡−2 + ⋯ + 𝜙𝑝 𝑌𝑡−𝑝 + 𝜀𝑡
Example:
AR (1): 𝑌𝑡 = 𝜙0 + 𝜙1 𝑌𝑡−1 + 𝜀𝑡
Example:
MA (1): 𝑌𝑡 = 𝜇 + 𝜀𝑡 − 𝜔1 𝜀𝑡−1
ARMA (p,q)
Example:
2. Define model
If data is nonstationary => differencing / take logarithm
❖ Non-seasonal diff: 𝑌𝑡′ = 𝑌𝑡 − 𝑌𝑡−1
𝑌𝑡 𝑌𝑡−1 𝑌𝑡′
15 - -
18 15 3
17 18 -1
16 17 -1
Example: d = 1, p = 1, q = 1
Δ𝑌𝑡 = 𝜙1 Δ𝑌𝑡−1 + 𝜀𝑡 − 𝜔1 𝜀𝑡−1
(𝑌𝑡 − 𝑌𝑡−1 ) = 𝜙1 (𝑌𝑡−1 − 𝑌𝑡−2 ) + 𝜀𝑡 − 𝜔1 𝜀𝑡−1
Sum up:
By counting the number of significant sample autocorrelations and partial autocorrelations, the orders of the
MA and AR parts can be determined.
Xác định d, D bằng cách nhìn vào tên của ACF, PACF
diff1 => d = 1 diff2 => d = 2
diff12 or diff4 => d = 0, D = 1
diff1diff12 => d = 1, D = 1
ACF PACF
Cut off after the order q
MA(q) Die out
of the process
Cut off after the order p
AR(p) Die out
of the process
Die out
ARMA(q, p) q = số time lag significant (trên ACF)
p = số time lag significant (trên PACF)
Example: no differencing
PRACTICE
ACF and PACF die out, ACF has 2 time lags with significant autocorrelation, PACF has 3 time lags with
significant autocorrelation => ARMA (2, 3)
Final Time Series
Noted by Mỹ Dung K20 Logistics
3. Write equation 𝒑 𝑷 𝒅 𝑫 𝒚𝒕 = 𝒄 + 𝒒 𝑸 𝜺𝒕
𝑦𝑡 = 𝑦𝑡−1
𝐵𝐵𝑦𝑡 = 𝐵2 𝑦𝑡 = 𝑦𝑡−2
𝐵4 𝑦𝑡 = 𝑦𝑡−4
❖ Nonseasonal: ARIMA (p, d, q)
𝑝 = 1 → (1 − 𝜙1 𝐵) ; 𝑝 = 2 → (1 − 𝜙1 𝐵 − 𝜙2 𝐵2 )
𝑞 = 1 → (1 − 𝜔1 𝐵); 𝑞 = 2 → (1 − 𝜔1 𝐵 − 𝜔2 𝐵2 )
𝑑 = 1 → (1 − 𝐵) ; 𝑑 = 2 → (1 − 𝐵)2
What if p/d/q = 0? → (1 − 0) = 1
ARIMA(1, 0, 2)
(1 − 𝜙1 𝐵)𝑦𝑡 = 𝑐 + (1 − 𝜔1 𝐵 − 𝜔2 𝐵2 )𝜀𝑡
ARIMA (1, 1, 0)
(1 − 𝜙1 𝐵)(1 − 𝐵)𝑦𝑡 = 𝑐 + 𝜀𝑡
(1 + 𝜙1 𝐵2 − 𝜙1 𝐵 − 𝐵)𝑦𝑡 = 𝑐 + 𝜀𝑡
ARIMA (0, 2, 1)
(1 − 𝐵)2 𝑦𝑡 = 𝑐 + (1 − 𝜔1 𝐵)𝜀𝑡
(1 − 2𝐵 + 𝐵2 )𝑦𝑡 = 𝑐 + (1 − 𝜔1 𝐵)𝜀𝑡
What if P/D/Q = 0? → (1 − 0) = 1
ARIMA (1,1,1)(1,1,1)4
ARIMA (1,0,0)(0,1,2)12
4. Model checking
In model AR (1)
𝜙1 = 0 → 𝑤ℎ𝑖𝑡𝑒 𝑛𝑜𝑖𝑠𝑒
𝜙1 = 1 → 𝑟𝑎𝑛𝑑𝑜𝑚 𝑤𝑎𝑙𝑘
Concept:
Check xem error có autocorrelation cao hay không, nếu nó cao (significant) thì model có vấn đề
(inadequate). Nếu error có autocorrelation thấp, gần bằng 0 (insignificant), nghĩa là error các time
period không liên quan nhau, thì model ổn (adequate).
Có 2 dạng bài tập:
+ Nhìn trực tiếp vào ACF của error (đề cho), nếu ACF insignificant cho hầu hết các time lags => adequate.
Và ngược lại.
+ Nhìn p-value của Ljung Box Test để kết luận. (test này group các time lags lại với nhau để so cho tiện,
cách làm t có để ở dưới)
Overall check of model adequacy is provided by a chi-square test based on the Ljung-Box Q statistic.
This test looks at the sizes of the residual autocorrelations as a group
𝑚
𝑟𝑘2 (𝑒)
𝑄 = 𝑛(𝑛 + 2) ∑
𝑛−𝑘
𝑘=1
Equation
𝑌𝑡 = 𝜙0 + 𝜙1 𝑌𝑡−1 + 𝜀𝑡 = 984.94 + 0.9045 𝑌𝑡−1
ARIMA (1, 1, 0)
(1 − 𝜙1 𝐵)(1 − 𝐵)𝑦𝑡 = 𝑐 + 𝑒𝑡
𝑦 = 𝜙0 + 𝜙1 𝑌𝑡−1 + 𝜙2 𝑌𝑡−2 + 𝜀𝑡
(1 − 𝐵 − 𝐵4 + 𝐵5 )𝑦𝑡 = 𝑐 + (1 − 𝜔1 𝐵 − Θ1 𝐵4 + 𝜔1 Θ1 𝐵5 )𝜀𝑡
Additional:
a. Phương trình đã có sẵn, mình chỉ cần thế số vô công thức thui. Mình tìm Y của t = bao nhiêu thì thế
giá trị Y của t= t-1 vào
c. Prediction interval 𝑦̂ ± 2𝑠
𝑦̂61 = 75.65