Applied Time Series Analysis FS 2011 – Week 14 Marcel Dettling Institute for Data Analysis and Process Design Zurich University of Applied Sciences marcel.dettling@zhaw.ch http://stat.ethz.ch/~dettling ETH Zürich, May 30, 2011 Marcel Dettling, Zurich University of Applied Sciences 1
Applied Time Series Analysis FS 2011 – Week 14 Non-Linear Models: ARIMA and SARIMA Why? We have seen that many time series we encounter in prac- tice show trends and/or seasonality. While we could de- compose them and model the stationary part, it might also be attractive to directly model a non-stationary series. How does it work? There is a mechanism, "the integration" or "the seasonal integration" which takes care of the deterministic features, while the remainder is modeled using an ARMA(p,q). There are some peculiarities! see blackboard! Marcel Dettling, Zurich University of Applied Sciences 2
Applied Time Series Analysis FS 2011 – Week 14 Example: Australian Beer Production Logged Australian Beer Production 5.4 log(beer) 5.0 4.6 4.2 1960 1965 1970 1975 1980 1985 1990 Time Logged Australian Beer Production, diff with lag 1 0.4 diff(log(beer)) 0.0 -0.4 1960 1965 1970 1975 1980 1985 1990 3 Time
Applied Time Series Analysis FS 2011 – Week 14 ARIMA(p,d,q)-Models Fit an ARMA(p,q) to a time series where the d th Idea : order difference with lag 1 was taken before. Example : If , Y X X (1 B X ) ~ ARMA p q ( , ) t t t 1 t then X ARIMA p q ~ ( ,1, ) t Notation : With backshift-operator B() d ( )(1 B B ) X ( ) B E t t Stationarity : ARIMA-models are usually non-stationary! Advantage : it‘s easier to forecast in R! Marcel Dettling, Zurich University of Applied Sciences 4
Applied Time Series Analysis FS 2011 – Week 14 Fitting and Forecasting We start by fitting an ARIMA(0,1,1) to the beer series: fit <- arima(log(beer), order=c(0,1,1)) > fit Call: arima(x = log(beer), order = c(0, 1, 1)) Coefficients: ma1 -0.2934 s.e. 0.0529 sigma^2 estimated as 0.01734 log likelihood = 240.28, aic = -476.57 Marcel Dettling, Zurich University of Applied Sciences 5
Applied Time Series Analysis FS 2011 – Week 14 Fitting and Forecasting We start by fitting an ARIMA(0,1,1) to the beer series: > fit.111 <- arima(log(beer), order=c(1,1,1)) > fit.111 Call: arima(x = log(beer), order = c(1, 1, 1)) Coefficients: ar1 ma1 0.5094 -0.9422 s.e. 0.0469 0.0125 sigma^2 estimated as 0.01491 log likelihood = 269.51, aic = -533.01 Marcel Dettling, Zurich University of Applied Sciences 6
Applied Time Series Analysis FS 2011 – Week 14 Forecasting Australian Beer Production Forecast of log(beer), ARIMA(0,1,1) 5.2 5.0 4.8 1985 1986 1987 1988 1989 1990 1991 Time Forecast of log(beer), ARIMA(1,1,1) 5.2 5.0 4.8 1985 1986 1987 1988 1989 1990 1991 7 Time
Applied Time Series Analysis FS 2011 – Week 14 Residual Analysis of the ARIMA(1,1,1) 0.2 0.0 series -0.2 -0.4 1960 1965 1970 1975 1980 1985 1990 Time part. Autokorr Auto-Korr. 0.5 0.2 -0.4 -0.5 0 5 10 15 20 25 1 5 10 15 20 25 8 Lag k Lag k
Applied Time Series Analysis FS 2011 – Week 14 ACF/PACF: Differenced Original Series 0.4 0.2 series 0.0 -0.2 -0.4 1960 1965 1970 1975 1980 1985 1990 Time part. Autokorr 1.0 Auto-Korr. 0.0 0.0 -0.4 0 5 10 15 20 25 1 5 10 15 20 25 9 Lag k Lag k
Applied Time Series Analysis FS 2011 – Week 14 Beer Series: Results • From the residuals, we cleary observe that the fitted models are not adequate, and thus the forecasts are not to be trusted • It seems as if we failed to include the seasonality into the model. This is visible from the residuals. • However, this is also visible from ACF/PACF of the original (differenced) series. This is where we made the "mistake" in the first place. • We need more complex models which can also deal with seasonality. They exist, see the following slides... Marcel Dettling, Zurich University of Applied Sciences 10
Applied Time Series Analysis FS 2011 – Week 14 SARIMA(p,d,q)(P,D,Q) s = a.k.a. Airline Model. We are looking at the log-trsf. airline data Log-Transformed Airline Data 600 400 AirPassengers 300 200 100 1950 1952 1954 1956 1958 1960 Time Marcel Dettling, Zurich University of Applied Sciences 11
Applied Time Series Analysis FS 2011 – Week 14 SARIMA(p,d,q)(P,D,Q) s or at the log-transformed Australian Beer Production Logged Australian Beer Production 5.4 5.2 5.0 log(beer) 4.8 4.6 4.4 4.2 1960 1965 1970 1975 1980 1985 1990 Time Marcel Dettling, Zurich University of Applied Sciences 12
Applied Time Series Analysis FS 2011 – Week 14 SARIMA(p,d,q)(P,D,Q) s We perform some differencing… ( see blackboard ) Marcel Dettling, Zurich University of Applied Sciences 13
Applied Time Series Analysis FS 2011 – Week 14 ACF/PACF of SARIMA(p,d,q)(P,D,Q) s 0.15 0.10 0.05 series 0.00 -0.05 -0.10 -0.15 1950 1952 1954 1956 1958 1960 Time 1.0 0.2 part. Autokorr Auto-Korr. 0.5 -0.1 0.0 -0.4 0 5 10 15 20 1 5 10 15 20 Lag k Lag k Marcel Dettling, Zurich University of Applied Sciences 14
Applied Time Series Analysis FS 2011 – Week 14 Modeling the Airline Data Since there are “big gaps” in ACF/PACF: 12 Z (1 B )(1 B ) E t 1 1 t E E E E t 1 t 1 1 t 12 1 1 t 13 This is an MA(13)-model with many coefficients equal to 0, or equivalently, a SARIMA(0,1,1)(0,1,1) 12 . Every SARIMA(p,d,q)(P,D,Q) s can be written as Note: an ARMA(p+sP,q+sQ), where many coefficients will be equal to 0. Marcel Dettling, Zurich University of Applied Sciences 15
Applied Time Series Analysis FS 2011 – Week 14 SARIMA(p,d,q)(P,D,Q) s The general notation is: d s D Y (1 B ) (1 B ) X t t s s s ( ) B ( B Y ) ( ) B ( B ) E t t Interpretation: - one typically chooses d=D=1 - s = periodicity in the data (season) - P,Q describe the dependency on multiples of the period see blackboard Marcel Dettling, Zurich University of Applied Sciences 16
Applied Time Series Analysis FS 2011 – Week 14 Forecasting Australian Beer Production Forecast of log(beer), SARIMA(1,1,1)(1,0,0) 5.3 5.2 5.1 5.0 4.9 4.8 1985 1986 1987 1988 1989 1990 1991 Time 17
Applied Time Series Analysis FS 2011 – Week 14 Residual Analysis of SARIMA(1,1,1)(1,1,0) 0.2 0.1 series 0.0 -0.1 -0.2 1960 1965 1970 1975 1980 1985 1990 Time part. Autokorr Auto-Korr. 0.6 0.0 -0.2 -0.3 0 5 10 15 20 25 1 5 10 15 20 25 Lag k Lag k 18
Applied Time Series Analysis FS 2011 – Week 14 Outlook to Non-Linear Models What are linear models? Models which can be written as a linear combination of X t i.e. all AR-, MA- and ARMA-models What are non-linear models? Everything else, e.g. non-linear combinations of , X t 2 terms like in the linear combination, and much more! X t Motivation for non-linear models? - modeling cyclic behavior with quicker increase then decrease - non-constant variance, even after transforming the series Marcel Dettling, Zurich University of Applied Sciences 19
Applied Time Series Analysis FS 2011 – Week 14 Simulated ARCH(1)-Process Simulated ARCH(1) process 2 0 x -2 -4 -6 0 200 400 600 800 1000 Time Marcel Dettling, Zurich University of Applied Sciences 20
Applied Time Series Analysis FS 2011 – Week 14 Residuals from a Fitted ARCH(1) x 2 Series 0 -2 -4 -6 0 200 400 600 800 1000 Time Residuals 4 2 Series 0 -2 -4 0 200 400 600 800 1000 Time Marcel Dettling, Zurich University of Applied Sciences 21
Applied Time Series Analysis FS 2011 – Week 14 ARCH(1) is Long-Tailed Histogram of x 400 Frequency 200 0 -6 -4 -2 0 2 4 Series Histogram of Residuals 250 Frequency 100 0 -4 -2 0 2 4 Series Marcel Dettling, Zurich University of Applied Sciences 22
Applied Time Series Analysis FS 2011 – Week 14 ARCH(1) is Long-Tailed Q-Q Plot of x Sample Quantiles 2 0 -2 -4 -6 -3 -2 -1 0 1 2 3 Normal Quantiles Q-Q Plot of Residuals 4 Sample Quantiles 2 0 -2 -4 -3 -2 -1 0 1 2 3 Normal Quantiles Marcel Dettling, Zurich University of Applied Sciences 23
Applied Time Series Analysis FS 2011 – Week 14 Dependency in the Squared Series ACF of Squared x 0.8 ACF 0.4 0.0 0 5 10 15 20 25 30 Lag ACF of Squared Residuals 0.8 ACF 0.4 0.0 0 5 10 15 20 25 30 Lag Marcel Dettling, Zurich University of Applied Sciences 24
Recommend
More recommend