Lecture 11 Seasonal ARIMA Colin Rundel 02/22/2017 1
Seasonal Models 2
Australian Wine Sales Example (Lecture 6) Australian total wine sales by wine makers in bottles <= 1 litre. Jan 1980 – 3 Aug 1994. wineind 35000 25000 15000 1980 1985 1990 1995 0.8 0.8 0.6 0.6 0.4 0.4 PACF ACF 0.2 0.2 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Differencing 4 diff(wineind) 10000 0 −10000 −25000 1980 1985 1990 1995 0.5 0.5 PACF ACF 0.0 0.0 −0.5 −0.5 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
p L q L L d P L s Q L s 1 1 L s 2 L 2 s P L Ps Seasonal ARIMA 1 2 L 2 s p L Qs D s 1 L s D 1 L d 1 We can extend the existing ARIMA model to handle these higher order lags p L q 2 L 2 1 L 1 p L p 2 L 2 1 L 1 where (without having to include all of the intervening lags). 5 Seasonal ARIMA ( p , d , q ) × ( P , D , Q ) s : Φ P ( L s ) ϕ p ( L ) ∆ D s ∆ d y t = δ + Θ Q ( L s ) θ q ( L ) w t
Seasonal ARIMA We can extend the existing ARIMA model to handle these higher order lags (without having to include all of the intervening lags). where 5 Seasonal ARIMA ( p , d , q ) × ( P , D , Q ) s : Φ P ( L s ) ϕ p ( L ) ∆ D s ∆ d y t = δ + Θ Q ( L s ) θ q ( L ) w t ϕ p ( L ) = 1 − ϕ 1 L − ϕ 2 L 2 − . . . − ϕ p L p θ q ( L ) = 1 + θ 1 L + θ 2 L 2 + . . . + θ p L q ∆ d = ( 1 − L ) d Φ P ( L s ) = 1 − Φ 1 L s − Φ 2 L 2 s − . . . − Φ P L Ps Θ Q ( L s ) = 1 + Θ 1 L + Θ 2 L 2 s + . . . + θ p L Qs ∆ D s = ( 1 − L s ) D
Seasonal ARIMA for wineind 0.8780 BIC=3302.29 AICc=3292.92 ## AIC=3292.78 log likelihood=-1643.39 ## sigma^2 estimated as 6906536: ## 1154.487 0.0314 ## s.e. 24489.243 ## mean sar1 ## ## Coefficients: ## ## ARIMA(0,0,0)(1,0,0)[12] with non-zero mean ## Series: wineind (m1 = Arima (wineind, seasonal= list (order= c (1,0,0), period=12))) 6 Lets consider an ARIMA ( 0 , 0 , 0 ) × ( 1 , 0 , 0 ) 12 : ( 1 − Φ 1 L 12 ) y t = δ + w t y t = Φ 1 y t − 12 + δ + w t
Fitted model 7 Model 1 − ARIMA (0,0,0) x (0,1,0)[12] [RMSE: 2613.05] 40000 30000 sales wineind model 20000 1980 1985 1990 1995 time
Residuals 8 m1$residuals 5000 0 −10000 1980 1985 1990 1995 0.2 0.2 0.1 0.1 PACF ACF 0.0 0.0 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Model 2 ## BIC=3050.88 AICc=3044.76 ## AIC=3044.68 log likelihood=-1520.34 ## sigma^2 estimated as 6588531: ## 0.0807 ## s.e. -0.3246 sma1 ## ## Coefficients: ## ## ARIMA(0,0,0)(0,1,1)[12] ## Series: wineind (m2 = Arima (wineind, order= c (0,0,0), seasonal= list (order= c (0,1,1), period=12))) 9 ARIMA ( 0 , 0 , 0 ) × ( 0 , 1 , 1 ) 12 : ( 1 − L 12 ) y t = δ + ( 1 + Θ 1 L 12 ) w t y t − y t − 12 = δ + w t + Θ 1 w t − 12 y t = δ + y t − 12 + w t + Θ 1 w t − 12
Fitted model 10 Model 2 − ARIMA (0,0,0) x (0,1,1)[12] [RMSE: 2470.2] 40000 30000 sales wineind model 20000 1980 1985 1990 1995 time
Residuals 11 m2$residuals 5000 0 −10000 1980 1985 1990 1995 0.2 0.2 0.1 0.1 PACF ACF 0.0 0.0 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Model 3 0.0755 sma1 ## 0.1402 0.0806 0.3040 -0.5790 ## s.e. 0.0813 ar2 0.0823 0.1023 ## ## sigma^2 estimated as 5948935: log likelihood=-1512.38 ## AIC=3034.77 AICc=3035.15 BIC=3050.27 ar3 ar1 12 ## ## Coefficients: ## ## ARIMA(3,0,0)(0,1,1)[12] ## Series: wineind seasonal= list (order= c (0,1,1), period=12))) (m3 = Arima (wineind, order= c (3,0,0), 3 3 ARIMA ( 3 , 0 , 0 ) × ( 0 , 1 , 1 ) 12 ( 1 − ϕ 1 L − ϕ 2 L 2 − ϕ 3 L 3 ) ( 1 − L 12 ) y t = δ + ( 1 + Θ 1 L ) w t ( 1 − ϕ 1 L − ϕ 2 L 2 − ϕ 3 L 3 ) ( y t − y t − 12 ) = δ + w t + w t − 12 ∑ ∑ y t = δ + ϕ i y t − 1 + y t − 12 − ϕ i y t − 12 − i + w t + w t − 12 i = 1 i = 1
Fitted model 13 Model 3 − ARIMA (3,0,0) x (0,1,1)[12] [RMSE: 2325.54] 40000 30000 sales wineind model 20000 1980 1985 1990 1995 time
Model - Residuals 14 m3$residuals 5000 0 −5000 1980 1985 1990 1995 0.2 0.2 0.1 0.1 PACF ACF 0.0 0.0 −0.1 −0.1 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Federal Reserve Board Production Index 15
prodn from the astsa package Monthly Federal Reserve Board Production Index (1948-1978) 16 prodn 120 80 40 1950 1955 1960 1965 1970 1975 1980 1.0 1.0 0.6 0.6 PACF ACF 0.2 0.2 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Differencing Based on the ACF it seems like standard differencing may be required 17 diff(prodn) 5 0 −5 −10 1950 1955 1960 1965 1970 1975 1980 0.8 0.8 0.6 0.6 0.4 0.4 PACF ACF 0.2 0.2 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Differencing + Seasonal Differencing (fr_m2 = Arima (prodn, order = c (0,1,0), BIC=1356.46 AICc=1352.59 ## AIC=1352.58 log likelihood=-675.29 ## sigma^2 estimated as 2.52: ## ## ARIMA(0,1,0)(0,1,0)[12] ## Series: prodn seasonal = list (order= c (0,1,0), period=12))) BIC=1788.43 Additional seasonal differencing also seems warranted AICc=1784.52 ## AIC=1784.51 log likelihood=-891.26 ## sigma^2 estimated as 7.147: ## ## ARIMA(0,1,0) ## Series: prodn seasonal = list (order= c (0,0,0), period=12))) (fr_m1 = Arima (prodn, order = c (0,1,0), 18
Residuals 19 fr_m2$residuals 6 4 2 −2 −6 1950 1955 1960 1965 1970 1975 1980 0.2 0.2 0.0 PACF 0.0 ACF −0.2 −0.2 −0.4 −0.4 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Adding Seasonal MA 0.0520 ## ## Coefficients: ## sma1 sma2 ## -0.7624 ## s.e. ## Series: prodn 0.0689 0.0666 ## ## sigma^2 estimated as 1.615: log likelihood=-598.98 ## AIC=1203.96 AICc=1204.02 BIC=1215.61 ## ARIMA(0,1,0)(0,1,2)[12] seasonal = list (order= c (0,1,2), period=12))) (fr_m3.1 = Arima (prodn, order = c (0,1,0), ## seasonal = list (order= c (0,1,1), period=12))) ## Series: prodn ## ARIMA(0,1,0)(0,1,1)[12] ## ## Coefficients: ## sma1 -0.7151 (fr_m3.2 = Arima (prodn, order = c (0,1,0), ## s.e. 0.0317 ## ## sigma^2 estimated as 1.616: log likelihood=-599.29 ## AIC=1202.57 AICc=1202.61 BIC=1210.34 20
Adding Seasonal MA (cont.) 0.2624 BIC=1198.69 AICc=1183.27 ## AIC=1183.15 log likelihood=-587.58 ## sigma^2 estimated as 1.506: ## 0.0529 0.0644 0.0529 ## s.e. -0.1205 (fr_m3.3 = Arima (prodn, order = c (0,1,0), -0.7853 ## sma3 sma2 sma1 ## ## Coefficients: ## ## ARIMA(0,1,0)(0,1,3)[12] ## Series: prodn seasonal = list (order= c (0,1,3), period=12))) 21
Residuals - Model 3.3 22 fr_m3.3$residuals 4 2 −2 −6 1950 1955 1960 1965 1970 1975 1980 0.3 0.3 0.2 0.2 0.1 0.1 PACF ACF 0.0 0.0 −0.2 −0.2 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Adding AR -0.1445 ## ## Coefficients: ## ar1 ar2 sma1 sma2 sma3 ## 0.3038 0.1077 -0.7393 0.2815 ## Series: prodn ## s.e. 0.0526 0.0538 0.0539 0.0653 0.0526 ## ## sigma^2 estimated as 1.331: log likelihood=-563.98 ## AIC=1139.97 AICc=1140.2 BIC=1163.26 ## ARIMA(2,1,0)(0,1,3)[12] seasonal = list (order= c (0,1,3), period=12))) (fr_m4.1 = Arima (prodn, order = c (1,1,0), -0.7619 seasonal = list (order= c (0,1,3), period=12))) ## Series: prodn ## ARIMA(1,1,0)(0,1,3)[12] ## ## Coefficients: ## ar1 sma1 sma2 sma3 ## 0.3393 -0.1222 (fr_m4.2 = Arima (prodn, order = c (2,1,0), 0.2756 ## s.e. 0.0500 0.0527 0.0646 0.0525 ## ## sigma^2 estimated as 1.341: log likelihood=-565.98 ## AIC=1141.95 AICc=1142.12 BIC=1161.37 23
Residuals - Model 4.1 24 fr_m4.1$residuals 4 2 0 −2 −6 1950 1955 1960 1965 1970 1975 1980 0.15 0.15 0.05 0.05 PACF ACF −0.05 −0.05 −0.15 −0.15 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Residuals - Model 4.2 25 fr_m4.2$residuals 4 2 0 −2 −6 1950 1955 1960 1965 1970 1975 1980 0.15 0.15 0.05 0.05 PACF ACF −0.05 −0.05 −0.15 −0.15 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
26 Model Fit Model 4.1 − ARIMA (1,1,0) x (0,1,3)[12] [RMSE: 1.131] 150 120 sales prodn 90 model 60 1950 1960 1970 1980 time
27 Model Forecast Forecasts from ARIMA(1,1,0)(0,1,3)[12] 150 100 50 1950 1955 1960 1965 1970 1975 1980
Model Forecast (cont.) 28 Forecasts from ARIMA(1,1,0)(0,1,3)[12] 150 100 50 1975 1976 1977 1978 1979 1980 1981 1982
Model Forecast (cont.) 29 Forecasts from ARIMA(1,1,0)(0,1,3)[12] 300 250 200 150 100 50 1950 1960 1970 1980 1990
30 Model Forecast (cont.) Forecasts from ARIMA(1,1,0)(0,1,3)[12] 300 250 200 150 100 50 1975 1980 1985 1990
Exercise - Cortecosteroid Drug Sales Monthly cortecosteroid drug sales in Australia from 1992 to 2008. 31 tsdisplay (h02,points=FALSE) library (fpp) h02 1.2 0.8 0.4 1995 2000 2005 0.6 0.6 0.2 PACF 0.2 ACF −0.2 −0.2 −0.6 −0.6 0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35 Lag Lag
Hint ts.intersect (h02, log (h02)) %>% plot () 32 . 1.2 1.0 h02 0.8 0.6 0.4 0.2 −0.2 log(h02) −0.6 −1.0 1995 2000 2005 Time
Recommend
More recommend