Forecasting: Principles and Practice. Rob J Hyndman. 12. Advanced methods OTexts.com/fpp/9/2/ OTexts.com/fpp/9/3/

Similar documents
Forecasting: principles and practice. Rob J Hyndman 3.2 Forecasting with multiple seasonality

FORECASTING USING R. Dynamic regression. Rob Hyndman Author, forecast

Forecasting using R. Rob J Hyndman. 2.4 Non-seasonal ARIMA models. Forecasting using R 1

Forecasting using R. Rob J Hyndman. 3.2 Dynamic regression. Forecasting using R 1

Transformations for variance stabilization

Vector Autoregression

Time Series Outlier Detection

Autoregressive distributed lag models

A time series is called strictly stationary if the joint distribution of every collection (Y t

FORECASTING SUGARCANE PRODUCTION IN INDIA WITH ARIMA MODEL

Multivariate Time Series

Time Series I Time Domain Methods

Package NlinTS. September 10, 2018

Lecture 7a: Vector Autoregression (VAR)

APPLIED TIME SERIES ECONOMETRICS

Dynamic Regression Models (Lect 15)

Vector autoregressions, VAR

Lecture 7a: Vector Autoregression (VAR)

Dynamic Time Series Regression: A Panacea for Spurious Correlations

Eco 5316 Time Series Econometrics. Lecture 16 Vector Autoregression (VAR) Models

Classic Time Series Analysis

Forecasting electricity load demand using hybrid exponential smoothing-artificial neural network model

Introduction to Natural Computation. Lecture 9. Multilayer Perceptrons and Backpropagation. Peter Lewis

Neural networks. Chapter 19, Sections 1 5 1

Impulse Response and Granger Causality in Dynamical Systems with Autoencoder Nonlinear Vector Autoregressions. Abstract

A SARIMAX coupled modelling applied to individual load curves intraday forecasting

Applied Time Series Topics

Vector Autoregressive Model. Vector Autoregressions II. Estimation of Vector Autoregressions II. Estimation of Vector Autoregressions I.

Financial Econometrics

Automatic forecasting with a modified exponential smoothing state space framework

Revisiting linear and non-linear methodologies for time series prediction - application to ESTSP 08 competition data

Forecasting using R. Rob J Hyndman. 2.5 Seasonal ARIMA models. Forecasting using R 1

Forecasting with R A practical workshop

Ch 8. MODEL DIAGNOSTICS. Time Series Analysis

Time Series Analysis. James D. Hamilton PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY

ECLT 5810 Classification Neural Networks. Reference: Data Mining: Concepts and Techniques By J. Hand, M. Kamber, and J. Pei, Morgan Kaufmann

A hybrid model of stock price prediction based on the PCA-ARIMA-BP

Booth School of Business, University of Chicago Business 41914, Spring Quarter 2013, Mr. Ruey S. Tsay. Midterm

Multivariate forecasting with VAR models

Econometric Forecasting

Time Series and Forecasting

Neural networks. Chapter 20. Chapter 20 1

A Course in Time Series Analysis

COGS Q250 Fall Homework 7: Learning in Neural Networks Due: 9:00am, Friday 2nd November.

5 Transfer function modelling

07 Multivariate models: Granger causality, VAR and VECM models. Andrius Buteikis,

STA 6857 VAR, VARMA, VARMAX ( 5.7)

Econometría 2: Análisis de series de Tiempo

Deep Feedforward Networks

Spectral Analysis. Al Nosedal University of Toronto. Winter Al Nosedal University of Toronto Spectral Analysis Winter / 71

Time series models: sparse estimation and robustness aspects

388 Index Differencing test ,232 Distributed lags , 147 arithmetic lag.

at least 50 and preferably 100 observations should be available to build a proper model

Multivariate time series modeling using VARMAX

ADAPTIVE FILTER THEORY

Circle the single best answer for each multiple choice question. Your choice should be made clearly.

Neural Network Approach to Estimating Conditional Quantile Polynomial Distributed Lag (QPDL) Model with an Application to Rubber Price Returns

Empirical Market Microstructure Analysis (EMMA)

The ARIMA Procedure: The ARIMA Procedure

TIME SERIES DATA ANALYSIS USING EVIEWS

Stat 5100 Handout #12.e Notes: ARIMA Models (Unit 7) Key here: after stationary, identify dependence structure (and use for forecasting)

Multilayer Perceptrons and Backpropagation

Seasonality. Matthieu Stigler January 8, Version 1.1

CSC242: Intro to AI. Lecture 21

Forecasting of a hydropower plant energy production

Time Series Analysis. James D. Hamilton PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY

2. Multivariate ARMA

Forecasting Arrivals and Occupancy Levels in an Emergency Department

Do we need Experts for Time Series Forecasting?

IDENTIFICATION OF ARMA MODELS

Introduction to Regression Analysis. Dr. Devlina Chatterjee 11 th August, 2017

10) Time series econometrics

1 Teaching notes on structural VARs.

Introduction to Time Series Analysis. Lecture 11.

Time Series Models and Inference. James L. Powell Department of Economics University of California, Berkeley

Ross Bettinger, Analytical Consultant, Seattle, WA

AR(p) + I(d) + MA(q) = ARIMA(p, d, q)

Booth School of Business, University of Chicago Business 41914, Spring Quarter 2017, Mr. Ruey S. Tsay. Solutions to Midterm

Vector Auto-Regressive Models

Chapter 6: Model Specification for Time Series

FEEDBACK GMDH-TYPE NEURAL NETWORK AND ITS APPLICATION TO MEDICAL IMAGE ANALYSIS OF LIVER CANCER. Tadashi Kondo and Junji Ueno

Neural networks (not in book)

Multivariate Time Series Analysis and Its Applications [Tsay (2005), chapter 8]

VAR Models and Applications

Testing for non-stationarity

Combination of M-Estimators and Neural Network Model to Analyze Inside/Outside Bark Tree Diameters

Time Series and Forecasting

Module 3. Descriptive Time Series Statistics and Introduction to Time Series Models

Short-term wind forecasting using artificial neural networks (ANNs)

Outline Introduction OLS Design of experiments Regression. Metamodeling. ME598/494 Lecture. Max Yi Ren

G. S. Maddala Kajal Lahiri. WILEY A John Wiley and Sons, Ltd., Publication

FE570 Financial Markets and Trading. Stevens Institute of Technology

Neural networks. Chapter 20, Section 5 1

Forecasting Arrivals and Occupancy Levels in an Emergency Department

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MAS451/MTH451 Time Series Analysis TIME ALLOWED: 2 HOURS

Introduction to Econometrics

Wavelet Neural Networks for Nonlinear Time Series Analysis

Regime switching models

Chapter 12: Linear regression II

MIDTERM: CS 6375 INSTRUCTOR: VIBHAV GOGATE October,

Transcription:

Rob J Hyndman Forecasting: Principles and Practice 12. Advanced methods OTexts.com/fpp/9/2/ OTexts.com/fpp/9/3/ Forecasting: Principles and Practice 1

Outline 1 Vector autoregressions 2 Neural network models 3 Time series with complex seasonality Forecasting: Principles and Practice Vector autoregressions 2

Vector autoregressions Dynamic regression assumes a unidirectional relationship: forecast variable influenced by predictor variables, but not vice versa. Vector AR allow for feedback relationships. All variables treated symmetrically. i.e., all variables are now treated as endogenous. Personal consumption may be affected by disposable income, and vice-versa. e.g., Govt stimulus package in Dec 2008 increased Christmas spending which increased incomes. Forecasting: Principles and Practice Vector autoregressions 3

Vector autoregressions Dynamic regression assumes a unidirectional relationship: forecast variable influenced by predictor variables, but not vice versa. Vector AR allow for feedback relationships. All variables treated symmetrically. i.e., all variables are now treated as endogenous. Personal consumption may be affected by disposable income, and vice-versa. e.g., Govt stimulus package in Dec 2008 increased Christmas spending which increased incomes. Forecasting: Principles and Practice Vector autoregressions 3

Vector autoregressions VAR(1) y 1,t = c 1 + φ 11,1 y 1,t 1 + φ 12,1 y 2,t 1 + e 1,t y 2,t = c 2 + φ 21,1 y 1,t 1 + φ 22,1 y 2,t 1 + e 2,t Forecasts: ŷ 1,T+1 T = ĉ 1 + ˆφ 11,1 y 1,T + ˆφ 12,1 y 2,T ŷ 2,T+1 T = ĉ 2 + ˆφ 21,1 y 1,T + ˆφ 22,1 y 2,T. ŷ 1,T+2 T = ĉ 1 + ˆφ 11,1 ŷ 1,T+1 + ˆφ 12,1 ŷ 2,T+1 ŷ 2,T+2 T = ĉ 2 + ˆφ 21,1 ŷ 1,T+1 + ˆφ 22,1 ŷ 2,T+1. Forecasting: Principles and Practice Vector autoregressions 4

Vector autoregressions VAR(1) y 1,t = c 1 + φ 11,1 y 1,t 1 + φ 12,1 y 2,t 1 + e 1,t y 2,t = c 2 + φ 21,1 y 1,t 1 + φ 22,1 y 2,t 1 + e 2,t Forecasts: ŷ 1,T+1 T = ĉ 1 + ˆφ 11,1 y 1,T + ˆφ 12,1 y 2,T ŷ 2,T+1 T = ĉ 2 + ˆφ 21,1 y 1,T + ˆφ 22,1 y 2,T. ŷ 1,T+2 T = ĉ 1 + ˆφ 11,1 ŷ 1,T+1 + ˆφ 12,1 ŷ 2,T+1 ŷ 2,T+2 T = ĉ 2 + ˆφ 21,1 ŷ 1,T+1 + ˆφ 22,1 ŷ 2,T+1. Forecasting: Principles and Practice Vector autoregressions 4

VARs are useful when forecasting a collection of related variables where no explicit interpretation is required; testing whether one variable is useful in forecasting another (the basis of Granger causality tests); impulse response analysis, where the response of one variable to a sudden but temporary change in another variable is analysed; forecast error variance decomposition, where the proportion of the forecast variance of one variable is attributed to the effect of other variables. Forecasting: Principles and Practice Vector autoregressions 5

VARs are useful when forecasting a collection of related variables where no explicit interpretation is required; testing whether one variable is useful in forecasting another (the basis of Granger causality tests); impulse response analysis, where the response of one variable to a sudden but temporary change in another variable is analysed; forecast error variance decomposition, where the proportion of the forecast variance of one variable is attributed to the effect of other variables. Forecasting: Principles and Practice Vector autoregressions 5

VARs are useful when forecasting a collection of related variables where no explicit interpretation is required; testing whether one variable is useful in forecasting another (the basis of Granger causality tests); impulse response analysis, where the response of one variable to a sudden but temporary change in another variable is analysed; forecast error variance decomposition, where the proportion of the forecast variance of one variable is attributed to the effect of other variables. Forecasting: Principles and Practice Vector autoregressions 5

VARs are useful when forecasting a collection of related variables where no explicit interpretation is required; testing whether one variable is useful in forecasting another (the basis of Granger causality tests); impulse response analysis, where the response of one variable to a sudden but temporary change in another variable is analysed; forecast error variance decomposition, where the proportion of the forecast variance of one variable is attributed to the effect of other variables. Forecasting: Principles and Practice Vector autoregressions 5

VAR example > ar(usconsumption,order=3) $ar,, 1 consumption income consumption 0.222 0.0424 income 0.475-0.2390,, 2 consumption income consumption 0.2001-0.0977 income 0.0288-0.1097,, 3 consumption income consumption 0.235-0.0238 income 0.406-0.0923 $var.pred consumption income consumption 0.393 0.193 income 0.193 0.735 Forecasting: Principles and Practice Vector autoregressions 6

VAR example > library(vars) > VARselect(usconsumption, lag.max=8, type="const")$selection AIC(n) HQ(n) SC(n) FPE(n) 5 1 1 5 > var <- VAR(usconsumption, p=3, type="const") > serial.test(var, lags.pt=10, type="pt.asymptotic") Portmanteau Test (asymptotic) data: Residuals of VAR object var Chi-squared = 33.3837, df = 28, p-value = 0.2219 Forecasting: Principles and Practice Vector autoregressions 7

VAR example > summary(var) VAR Estimation Results: ========================= Endogenous variables: consumption, income Deterministic variables: const Sample size: 161 Estimation results for equation consumption: ============================================ Estimate Std. Error t value Pr(> t ) consumption.l1 0.22280 0.08580 2.597 0.010326 * income.l1 0.04037 0.06230 0.648 0.518003 consumption.l2 0.20142 0.09000 2.238 0.026650 * income.l2-0.09830 0.06411-1.533 0.127267 consumption.l3 0.23512 0.08824 2.665 0.008530 ** income.l3-0.02416 0.06139-0.394 0.694427 const 0.31972 0.09119 3.506 0.000596 *** Forecasting: Principles and Practice Vector autoregressions 8

VAR example Estimation results for equation income: ======================================= Estimate Std. Error t value Pr(> t ) consumption.l1 0.48705 0.11637 4.186 4.77e-05 *** income.l1-0.24881 0.08450-2.945 0.003736 ** consumption.l2 0.03222 0.12206 0.264 0.792135 income.l2-0.11112 0.08695-1.278 0.203170 consumption.l3 0.40297 0.11967 3.367 0.000959 *** income.l3-0.09150 0.08326-1.099 0.273484 const 0.36280 0.12368 2.933 0.003865 ** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 Correlation matrix of residuals: consumption income consumption 1.0000 0.3639 income 0.3639 1.0000 Forecasting: Principles and Practice Vector autoregressions 9

VAR example fcst <- forecast(var) plot(fcst, xlab="year") Forecasting: Principles and Practice Vector autoregressions 10

VAR example Forecasts from VAR(3) income 2 0 1 2 3 4 consumption 2 1 0 1 2 1970 1980 1990 2000 2010 Year Forecasting: Principles and Practice Vector autoregressions 11

Outline 1 Vector autoregressions 2 Neural network models 3 Time series with complex seasonality Forecasting: Principles and Practice Neural network models 12

Neural network models Simplest version: linear regression Input Output layer layer Input #1 Input #2 Input #3 Output Input #4 Coefficients attached to predictors are called weights. Forecasts are obtained by a linear combination of inputs. Weights selected using a learning algorithm that minimises a cost function. Forecasting: Principles and Practice Neural network models 13

Neural network models Simplest version: linear regression Input Output layer layer Input #1 Input #2 Input #3 Output Input #4 Coefficients attached to predictors are called weights. Forecasts are obtained by a linear combination of inputs. Weights selected using a learning algorithm that minimises a cost function. Forecasting: Principles and Practice Neural network models 13

Neural network models Simplest version: linear regression Input Output layer layer Input #1 Input #2 Input #3 Output Input #4 Coefficients attached to predictors are called weights. Forecasts are obtained by a linear combination of inputs. Weights selected using a learning algorithm that minimises a cost function. Forecasting: Principles and Practice Neural network models 13

Neural network models Simplest version: linear regression Input Output layer layer Input #1 Input #2 Input #3 Output Input #4 Coefficients attached to predictors are called weights. Forecasts are obtained by a linear combination of inputs. Weights selected using a learning algorithm that minimises a cost function. Forecasting: Principles and Practice Neural network models 13

Neural network models Nonlinear model with one hidden layer Input Hidden Output layer layer layer Input #1 Input #2 Input #3 Output Input #4 A multilayer feed-forward network where each layer of nodes receives inputs from the previous layers. Inputs to each node combined using linear combination. Result modified by nonlinear function before being output. Forecasting: Principles and Practice Neural network models 14

Neural network models Nonlinear model with one hidden layer Input Hidden Output layer layer layer Input #1 Input #2 Input #3 Output Input #4 A multilayer feed-forward network where each layer of nodes receives inputs from the previous layers. Inputs to each node combined using linear combination. Result modified by nonlinear function before being output. Forecasting: Principles and Practice Neural network models 14

Neural network models Nonlinear model with one hidden layer Input Hidden Output layer layer layer Input #1 Input #2 Input #3 Output Input #4 A multilayer feed-forward network where each layer of nodes receives inputs from the previous layers. Inputs to each node combined using linear combination. Result modified by nonlinear function before being output. Forecasting: Principles and Practice Neural network models 14

Neural network models Nonlinear model with one hidden layer Input Hidden Output layer layer layer Input #1 Input #2 Input #3 Output Input #4 A multilayer feed-forward network where each layer of nodes receives inputs from the previous layers. Inputs to each node combined using linear combination. Result modified by nonlinear function before being output. Forecasting: Principles and Practice Neural network models 14

Neural network models Inputs to hidden neuron j linearly combined: z j = b j + 4 w i,j x i. i=1 Modified using nonlinear function such as a sigmoid: s(z) = 1 1 + e z, This tends to reduce the effect of extreme input values, thus making the network somewhat robust to outliers. Forecasting: Principles and Practice Neural network models 15

Neural network models Weights take random values to begin with, which are then updated using the observed data. There is an element of randomness in the predictions. So the network is usually trained several times using different random starting points, and the results are averaged. Number of hidden layers, and the number of nodes in each hidden layer, must be specified in advance. Forecasting: Principles and Practice Neural network models 16

Neural network models Weights take random values to begin with, which are then updated using the observed data. There is an element of randomness in the predictions. So the network is usually trained several times using different random starting points, and the results are averaged. Number of hidden layers, and the number of nodes in each hidden layer, must be specified in advance. Forecasting: Principles and Practice Neural network models 16

Neural network models Weights take random values to begin with, which are then updated using the observed data. There is an element of randomness in the predictions. So the network is usually trained several times using different random starting points, and the results are averaged. Number of hidden layers, and the number of nodes in each hidden layer, must be specified in advance. Forecasting: Principles and Practice Neural network models 16

NNAR models Lagged values of the time series can be used as inputs to a neural network. NNAR(p, k): p lagged inputs and k nodes in the single hidden layer. NNAR(p, 0) model is equivalent to an ARIMA(p, 0, 0) model but without stationarity restrictions. Seasonal NNAR(p, P, k): inputs (y t 1, y t 2,..., y t p, y t m, y t 2m, y t Pm ) and k neurons in the hidden layer. NNAR(p, P, 0) m model is equivalent to an ARIMA(p, 0, 0)(P,0,0) m model but without stationarity restrictions. Forecasting: Principles and Practice Neural network models 17

NNAR models Lagged values of the time series can be used as inputs to a neural network. NNAR(p, k): p lagged inputs and k nodes in the single hidden layer. NNAR(p, 0) model is equivalent to an ARIMA(p, 0, 0) model but without stationarity restrictions. Seasonal NNAR(p, P, k): inputs (y t 1, y t 2,..., y t p, y t m, y t 2m, y t Pm ) and k neurons in the hidden layer. NNAR(p, P, 0) m model is equivalent to an ARIMA(p, 0, 0)(P,0,0) m model but without stationarity restrictions. Forecasting: Principles and Practice Neural network models 17

NNAR models Lagged values of the time series can be used as inputs to a neural network. NNAR(p, k): p lagged inputs and k nodes in the single hidden layer. NNAR(p, 0) model is equivalent to an ARIMA(p, 0, 0) model but without stationarity restrictions. Seasonal NNAR(p, P, k): inputs (y t 1, y t 2,..., y t p, y t m, y t 2m, y t Pm ) and k neurons in the hidden layer. NNAR(p, P, 0) m model is equivalent to an ARIMA(p, 0, 0)(P,0,0) m model but without stationarity restrictions. Forecasting: Principles and Practice Neural network models 17

NNAR models Lagged values of the time series can be used as inputs to a neural network. NNAR(p, k): p lagged inputs and k nodes in the single hidden layer. NNAR(p, 0) model is equivalent to an ARIMA(p, 0, 0) model but without stationarity restrictions. Seasonal NNAR(p, P, k): inputs (y t 1, y t 2,..., y t p, y t m, y t 2m, y t Pm ) and k neurons in the hidden layer. NNAR(p, P, 0) m model is equivalent to an ARIMA(p, 0, 0)(P,0,0) m model but without stationarity restrictions. Forecasting: Principles and Practice Neural network models 17

NNAR models Lagged values of the time series can be used as inputs to a neural network. NNAR(p, k): p lagged inputs and k nodes in the single hidden layer. NNAR(p, 0) model is equivalent to an ARIMA(p, 0, 0) model but without stationarity restrictions. Seasonal NNAR(p, P, k): inputs (y t 1, y t 2,..., y t p, y t m, y t 2m, y t Pm ) and k neurons in the hidden layer. NNAR(p, P, 0) m model is equivalent to an ARIMA(p, 0, 0)(P,0,0) m model but without stationarity restrictions. Forecasting: Principles and Practice Neural network models 17

NNAR models in R The nnetar() function fits an NNAR(p, P, k) m model. If p and P are not specified, they are automatically selected. For non-seasonal time series, default p = optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, defaults are P = 1 and p is chosen from the optimal linear model fitted to the seasonally adjusted data. Default k = (p + P + 1)/2 (rounded to the nearest integer). Forecasting: Principles and Practice Neural network models 18

NNAR models in R The nnetar() function fits an NNAR(p, P, k) m model. If p and P are not specified, they are automatically selected. For non-seasonal time series, default p = optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, defaults are P = 1 and p is chosen from the optimal linear model fitted to the seasonally adjusted data. Default k = (p + P + 1)/2 (rounded to the nearest integer). Forecasting: Principles and Practice Neural network models 18

NNAR models in R The nnetar() function fits an NNAR(p, P, k) m model. If p and P are not specified, they are automatically selected. For non-seasonal time series, default p = optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, defaults are P = 1 and p is chosen from the optimal linear model fitted to the seasonally adjusted data. Default k = (p + P + 1)/2 (rounded to the nearest integer). Forecasting: Principles and Practice Neural network models 18

NNAR models in R The nnetar() function fits an NNAR(p, P, k) m model. If p and P are not specified, they are automatically selected. For non-seasonal time series, default p = optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, defaults are P = 1 and p is chosen from the optimal linear model fitted to the seasonally adjusted data. Default k = (p + P + 1)/2 (rounded to the nearest integer). Forecasting: Principles and Practice Neural network models 18

NNAR models in R The nnetar() function fits an NNAR(p, P, k) m model. If p and P are not specified, they are automatically selected. For non-seasonal time series, default p = optimal number of lags (according to the AIC) for a linear AR(p) model. For seasonal time series, defaults are P = 1 and p is chosen from the optimal linear model fitted to the seasonally adjusted data. Default k = (p + P + 1)/2 (rounded to the nearest integer). Forecasting: Principles and Practice Neural network models 18

Sunspots Surface of the sun contains magnetic regions that appear as dark spots. These affect the propagation of radio waves and so telecommunication companies like to predict sunspot activity in order to plan for any future difficulties. Sunspots follow a cycle of length between 9 and 14 years. Forecasting: Principles and Practice Neural network models 19

Sunspots Surface of the sun contains magnetic regions that appear as dark spots. These affect the propagation of radio waves and so telecommunication companies like to predict sunspot activity in order to plan for any future difficulties. Sunspots follow a cycle of length between 9 and 14 years. Forecasting: Principles and Practice Neural network models 19

Sunspots Surface of the sun contains magnetic regions that appear as dark spots. These affect the propagation of radio waves and so telecommunication companies like to predict sunspot activity in order to plan for any future difficulties. Sunspots follow a cycle of length between 9 and 14 years. Forecasting: Principles and Practice Neural network models 19

NNAR(9,5) model for sunspots Forecasts from NNAR(9) 1900 1950 2000 Forecasting: Principles and Practice Neural network models 20

NNAR model for sunspots fit <- nnetar(sunspotarea) plot(forecast(fit,h=20)) To restrict to positive values: fit <- nnetar(sunspotarea,lambda=0) plot(forecast(fit,h=20)) Forecasting: Principles and Practice Neural network models 21

NNAR model for sunspots fit <- nnetar(sunspotarea) plot(forecast(fit,h=20)) To restrict to positive values: fit <- nnetar(sunspotarea,lambda=0) plot(forecast(fit,h=20)) Forecasting: Principles and Practice Neural network models 21

Outline 1 Vector autoregressions 2 Neural network models 3 Time series with complex seasonality Forecasting: Principles and Practice Time series with complex seasonality 22

Examples US finished motor gasoline products Thousands of barrels per day 6500 7000 7500 8000 8500 9000 9500 1992 1994 1996 1998 2000 2002 2004 Weeks Forecasting: Principles and Practice Time series with complex seasonality 23

Examples Number of calls to large American bank (7am 9pm) Number of call arrivals 100 200 300 400 3 March 17 March 31 March 14 April 28 April 12 May 5 minute intervals Forecasting: Principles and Practice Time series with complex seasonality 23

Examples Turkish electricity demand Electricity demand (GW) 10 15 20 25 2000 2002 2004 2006 2008 Days Forecasting: Principles and Practice Time series with complex seasonality 23

TBATS model TBATS Trigonometric terms for seasonality Box-Cox transformations for heterogeneity ARMA errors for short-term dynamics Trend (possibly damped) Seasonal (including multiple and non-integer periods) Forecasting: Principles and Practice Time series with complex seasonality 24

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 l t = l t 1 + φb t 1 + αd t s (i) t m i + d t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = s(i) j,t 1 cos λ(i) j + s (i) j,t 1 sin λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 s (i) t m i + d t Box-Cox transformation l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = s(i) j,t 1 cos λ(i) j + s (i) j,t 1 sin λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 s (i) t m i + d t Box-Cox transformation M seasonal periods l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = s(i) j,t 1 cos λ(i) j + s (i) j,t 1 sin λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 s (i) t m i + d t Box-Cox transformation M seasonal periods l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = global and local trend s(i) j,t 1 cos λ(i) j + s (i) j,t 1 sin λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 s (i) t m i + d t Box-Cox transformation M seasonal periods l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = global and local trend ARMA error s(i) j,t 1 cos λ(i) j + s (i) j,t 1 sin λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = log y t if ω = 0. y (ω) t = l t 1 + φb t 1 + M i=1 s (i) t m i + d t Box-Cox transformation M seasonal periods l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p q d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 s (i) j,t j=1 s (i) j,t = s(i) j,t 1 global and local trend ARMA error Fourier-like seasonal terms+ s (i) j,t 1 sin λ(i) j cos λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

TBATS model y t = observation at time t { y (ω) (y ω t 1)/ω if ω 0; t = logtbats y t if ω = 0. Trigonometric M y (ω) t = l t 1 + φb t 1 + s (i) t m i + d t i=1 l t = l t 1 + φb t 1 + αd t b t = (1 φ)b + φb t 1 + βd t p Trendq d t = φ i d t i + θ j ε t j + ε t s (i) t = i=1 k i j=1 Box-Cox ARMA Seasonal s (i) j,t j=1 s (i) j,t = s(i) j,t 1 Box-Cox transformation M seasonal periods global and local trend ARMA error Fourier-like seasonal terms+ s (i) j,t 1 sin λ(i) j cos λ(i) j + γ (i) 1 d t s (i) = j,t s(i) j,t 1 sin λ(i) j + s (i) j,t 1 cos λ(i) j + γ (i) 2 d t Forecasting: Principles and Practice Time series with complex seasonality 25

Examples Forecasts from TBATS(0.999, {2,2}, 1, {<52.1785714285714,8>}) Thousands of barrels per day 7000 8000 9000 10000 fit <- tbats(gasoline) fcast <- forecast(fit) plot(fcast) 1995 2000 2005 Weeks Forecasting: Principles and Practice Time series with complex seasonality 26

Number of call arrivals Examples 0 100 200 300 400 500 Forecasts from TBATS(1, {3,1}, 0.987, {<169,5>, <845,3>}) fit <- tbats(callcentre) fcast <- forecast(fit) plot(fcast) 3 March 17 March 31 March 14 April 28 April 12 May 26 May 9 June 5 minute intervals Forecasting: Principles and Practice Time series with complex seasonality 27

Examples Forecasts from TBATS(0, {5,3}, 0.997, {<7,3>, <354.37,12>, <365.25,4>}) Electricity demand (GW) 10 15 20 25 fit <- tbats(turk) fcast <- forecast(fit) plot(fcast) 2000 2002 2004 2006 2008 2010 Days Forecasting: Principles and Practice Time series with complex seasonality 28