Advances in automatic time series forecasting

182
Advances in automatic time series forecasting Advances in automatic time series forecasting 1 Rob J Hyndman

description

Invited talk, Australian Statistical Conference, Adelaide, July 2012.

Transcript of Advances in automatic time series forecasting

Page 1: Advances in automatic time series forecasting

Advances inautomatictime series forecasting

Advances in automatic time series forecasting 1

Rob J Hyndman

Page 2: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Motivation 2

Page 3: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 4: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 5: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 6: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 7: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 8: Advances in automatic time series forecasting

Motivation

Advances in automatic time series forecasting Motivation 3

Page 9: Advances in automatic time series forecasting

Motivation

1 Common in business to have over 1000products that need forecasting at least monthly.

2 Forecasts are often required by people who areuntrained in time series analysis.

3 Some types of data can be decomposed into alarge number of univariate time series thatneed to be forecast.

Specifications

Automatic forecasting algorithms must:

å determine an appropriate time series model;

å estimate the parameters;

å compute the forecasts with prediction intervals.Advances in automatic time series forecasting Motivation 4

Page 10: Advances in automatic time series forecasting

Motivation

1 Common in business to have over 1000products that need forecasting at least monthly.

2 Forecasts are often required by people who areuntrained in time series analysis.

3 Some types of data can be decomposed into alarge number of univariate time series thatneed to be forecast.

Specifications

Automatic forecasting algorithms must:

å determine an appropriate time series model;

å estimate the parameters;

å compute the forecasts with prediction intervals.Advances in automatic time series forecasting Motivation 4

Page 11: Advances in automatic time series forecasting

Motivation

1 Common in business to have over 1000products that need forecasting at least monthly.

2 Forecasts are often required by people who areuntrained in time series analysis.

3 Some types of data can be decomposed into alarge number of univariate time series thatneed to be forecast.

Specifications

Automatic forecasting algorithms must:

å determine an appropriate time series model;

å estimate the parameters;

å compute the forecasts with prediction intervals.Advances in automatic time series forecasting Motivation 4

Page 12: Advances in automatic time series forecasting

Motivation

1 Common in business to have over 1000products that need forecasting at least monthly.

2 Forecasts are often required by people who areuntrained in time series analysis.

3 Some types of data can be decomposed into alarge number of univariate time series thatneed to be forecast.

Specifications

Automatic forecasting algorithms must:

å determine an appropriate time series model;

å estimate the parameters;

å compute the forecasts with prediction intervals.Advances in automatic time series forecasting Motivation 4

Page 13: Advances in automatic time series forecasting

Motivation

1 Common in business to have over 1000products that need forecasting at least monthly.

2 Forecasts are often required by people who areuntrained in time series analysis.

3 Some types of data can be decomposed into alarge number of univariate time series thatneed to be forecast.

Specifications

Automatic forecasting algorithms must:

å determine an appropriate time series model;

å estimate the parameters;

å compute the forecasts with prediction intervals.Advances in automatic time series forecasting Motivation 4

Page 14: Advances in automatic time series forecasting

Example: Cortecosteroid sales

Advances in automatic time series forecasting Motivation 5

Monthly cortecosteroid drug sales in Australia

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 15: Advances in automatic time series forecasting

Example: Cortecosteroid sales

Advances in automatic time series forecasting Motivation 5

Automatic ARIMA forecasts

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 16: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Exponential smoothing 6

Page 17: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

Advances in automatic time series forecasting Exponential smoothing 7

Page 18: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothing

Advances in automatic time series forecasting Exponential smoothing 7

Page 19: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear method

Advances in automatic time series forecasting Exponential smoothing 7

Page 20: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear methodAd,N: Additive damped trend method

Advances in automatic time series forecasting Exponential smoothing 7

Page 21: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear methodAd,N: Additive damped trend methodM,N: Exponential trend method

Advances in automatic time series forecasting Exponential smoothing 7

Page 22: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear methodAd,N: Additive damped trend methodM,N: Exponential trend methodMd,N: Multiplicative damped trend method

Advances in automatic time series forecasting Exponential smoothing 7

Page 23: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear methodAd,N: Additive damped trend methodM,N: Exponential trend methodMd,N: Multiplicative damped trend methodA,A: Additive Holt-Winters’ method

Advances in automatic time series forecasting Exponential smoothing 7

Page 24: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

N,N: Simple exponential smoothingA,N: Holt’s linear methodAd,N: Additive damped trend methodM,N: Exponential trend methodMd,N: Multiplicative damped trend methodA,A: Additive Holt-Winters’ methodA,M: Multiplicative Holt-Winters’ method

Advances in automatic time series forecasting Exponential smoothing 7

Page 25: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

There are 15 separate exponential smoothingmethods.

Advances in automatic time series forecasting Exponential smoothing 7

Page 26: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

There are 15 separate exponential smoothingmethods.Each can have an additive or multiplicativeerror, giving 30 separate models.

Advances in automatic time series forecasting Exponential smoothing 7

Page 27: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing

Examples:A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 28: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing

Examples:A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 29: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing↑

TrendExamples:

A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 30: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing↑

Trend SeasonalExamples:

A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 31: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing ↑

Error Trend SeasonalExamples:

A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 32: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing ↑

Error Trend SeasonalExamples:

A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Page 33: Advances in automatic time series forecasting

Exponential smoothing methods

Seasonal ComponentTrend N A M

Component (None) (Additive) (Multiplicative)

N (None) N,N N,A N,M

A (Additive) A,N A,A A,M

Ad (Additive damped) Ad,N Ad,A Ad,M

M (Multiplicative) M,N M,A M,M

Md (Multiplicative damped) Md,N Md,A Md,M

General notation E T S : ExponenTial Smoothing ↑

Error Trend SeasonalExamples:

A,N,N: Simple exponential smoothing with additive errorsA,A,N: Holt’s linear method with additive errorsM,A,M: Multiplicative Holt-Winters’ method with multiplicative errorsAdvances in automatic time series forecasting Exponential smoothing 8

Innovations state space models

å All ETS models can be written in innovationsstate space form.

å Additive and multiplicative versions give thesame point forecasts but different predictionintervals.

Page 34: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 35: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 36: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 37: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 38: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 39: Advances in automatic time series forecasting

Automatic forecasting

From Hyndman et al. (IJF, 2002):

Apply each of 30 models that are appropriate tothe data. Optimize parameters and initialvalues using MLE (or some other criterion).

Select best method using AIC:

AIC = −2 log(Likelihood) + 2p

where p = # parameters.

Produce forecasts using best method.

Obtain prediction intervals using underlyingstate space model.

Method performed very well in M3 competition.Advances in automatic time series forecasting Exponential smoothing 9

Page 40: Advances in automatic time series forecasting

Exponential smoothing

Advances in automatic time series forecasting Exponential smoothing 10

Automatic ETS forecasts

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 41: Advances in automatic time series forecasting

Exponential smoothing

library(forecast)fit <- ets(h02)fcast <- forecast(fit)plot(fcast)

Advances in automatic time series forecasting Exponential smoothing 11

Automatic ETS forecasts

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 42: Advances in automatic time series forecasting

Exponential smoothing> fitETS(M,Md,M)

Smoothing parameters:alpha = 0.3318beta = 4e-04gamma = 1e-04phi = 0.9695

Initial states:l = 0.4003b = 1.0233s = 0.8575 0.8183 0.7559 0.7627 0.6873 1.2884

1.3456 1.1867 1.1653 1.1033 1.0398 0.9893

sigma: 0.0651

AIC AICc BIC-121.97999 -118.68967 -65.57195

Advances in automatic time series forecasting Exponential smoothing 12

Page 43: Advances in automatic time series forecasting

References

Hyndman, Koehler, Snyder, Grose (2002). “Astate space framework for automaticforecasting using exponential smoothingmethods”. International Journal of Forecasting18(3), 439–454

Hyndman, Koehler, Ord, Snyder (2008).Forecasting with exponential smoothing: thestate space approach. Berlin: Springer-Verlag.www.exponentialsmoothing.net

Hyndman (2012). forecast: Forecastingfunctions for time series.cran.r-project.org/package=forecast

Advances in automatic time series forecasting Exponential smoothing 13

Page 44: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting ARIMA modelling 14

Page 45: Advances in automatic time series forecasting

How does auto.arima() work?

A non-seasonal ARIMA process

φ(B)(1− B)dyt = c + θ(B)εt

Need to select appropriate orders p,q,d, andwhether to include c.

Advances in automatic time series forecasting ARIMA modelling 15

Page 46: Advances in automatic time series forecasting

How does auto.arima() work?

A non-seasonal ARIMA process

φ(B)(1− B)dyt = c + θ(B)εt

Need to select appropriate orders p,q,d, andwhether to include c.

Hyndman & Khandakar (JSS, 2008) algorithm:Select no. differences d via KPSS unit root test.Select p,q, c by minimising AIC.Use stepwise search to traverse model space,starting with a simple model and consideringnearby variants.

Advances in automatic time series forecasting ARIMA modelling 15

Page 47: Advances in automatic time series forecasting

How does auto.arima() work?

A seasonal ARIMA process

Φ(Bm)φ(B)(1− B)d(1− Bm)Dyt = c + Θ(Bm)θ(B)εt

Need to select appropriate orders p,q,d, P,Q,D, andwhether to include c.

Hyndman & Khandakar (JSS, 2008) algorithm:Select no. differences d via KPSS unit root test.Select D using OCSB unit root test.Select p,q, P,Q, c by minimising AIC.Use stepwise search to traverse model space,starting with a simple model and consideringnearby variants.

Advances in automatic time series forecasting ARIMA modelling 16

Page 48: Advances in automatic time series forecasting

Auto ARIMA

Advances in automatic time series forecasting ARIMA modelling 17

Automatic ARIMA forecasts

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 49: Advances in automatic time series forecasting

Auto ARIMA

fit <- auto.arima(h02)fcast <- forecast(fit)plot(fcast)

Advances in automatic time series forecasting ARIMA modelling 18

Automatic ARIMA forecasts

Year

Tota

l scr

ipts

(m

illio

ns)

1995 2000 2005 2010

0.4

0.6

0.8

1.0

1.2

1.4

1.6

Page 50: Advances in automatic time series forecasting

Auto ARIMA

> fitSeries: h02ARIMA(3,1,3)(0,1,1)[12]

Coefficients:ar1 ar2 ar3 ma1 ma2 ma3

-0.3648 -0.0636 0.3568 -0.4850 0.0479 -0.353s.e. 0.2198 0.3293 0.1268 0.2227 0.2755 0.212

sma1-0.5931

s.e. 0.0651

sigma^2 estimated as 0.002706: log likelihood=290.25AIC=-564.5 AICc=-563.71 BIC=-538.48

Advances in automatic time series forecasting ARIMA modelling 19

Page 51: Advances in automatic time series forecasting

References

Hyndman, Khandakar (2008). “Automatic timeseries forecasting : the forecast package for R”.Journal of Statistical Software 26(3)

Hyndman (2011). “Major changes to theforecast package”.robjhyndman.com/researchtips/forecast3/.

Hyndman (2012). forecast: Forecastingfunctions for time series.cran.r-project.org/package=forecast

Advances in automatic time series forecasting ARIMA modelling 20

Page 52: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Time series with complex seasonality 21

Page 53: Advances in automatic time series forecasting

Examples

Advances in automatic time series forecasting Time series with complex seasonality 22

US finished motor gasoline products

Weeks

Tho

usan

ds o

f bar

rels

per

day

1992 1994 1996 1998 2000 2002 2004

6500

7000

7500

8000

8500

9000

9500

Page 54: Advances in automatic time series forecasting

Examples

Advances in automatic time series forecasting Time series with complex seasonality 22

Number of calls to large American bank (7am−9pm)

5 minute intervals

Num

ber

of c

all a

rriv

als

100

200

300

400

3 March 17 March 31 March 14 April 28 April 12 May

Page 55: Advances in automatic time series forecasting

Examples

Advances in automatic time series forecasting Time series with complex seasonality 22

Turkish electricity demand

Days

Ele

ctric

ity d

eman

d (G

W)

2000 2002 2004 2006 2008

1015

2025

Page 56: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Page 57: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

Page 58: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

M seasonal periods

Page 59: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

M seasonal periods

global and local trend

Page 60: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

M seasonal periods

global and local trend

ARMA error

Page 61: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

M seasonal periods

global and local trend

ARMA error

Fourier-like seasonalterms

Page 62: Advances in automatic time series forecasting

TBATS model

yt = observation at time t

y(ω)t =

(yωt − 1)/ω if ω 6= 0;

log yt if ω = 0.

y(ω)t = `t−1 + φbt−1 +M∑i=1

s(i)t−mi+ dt

`t = `t−1 + φbt−1 + αdt

bt = (1− φ)b + φbt−1 + βdt

dt =

p∑i=1

φidt−i +

q∑j=1

θjεt−j + εt

s(i)t =

ki∑j=1

s(i)j,t

Advances in automatic time series forecasting Time series with complex seasonality 23

s(i)j,t = s(i)j,t−1 cosλ(i)j + s∗(i)j,t−1 sinλ(i)j + γ(i)1 dt

s(i)j,t = −s(i)j,t−1 sinλ(i)j + s∗(i)j,t−1 cosλ(i)j + γ(i)2 dt

Box-Cox transformation

M seasonal periods

global and local trend

ARMA error

Fourier-like seasonalterms

TBATSTrigonometric

Box-Cox

ARMA

Trend

Seasonal

Page 63: Advances in automatic time series forecasting

Examples

fit <- tbats(gasoline)fcast <- forecast(fit)plot(fcast)

Advances in automatic time series forecasting Time series with complex seasonality 24

Forecasts from TBATS(0.999, 2,2, 1, <52.1785714285714,8>)

Weeks

Tho

usan

ds o

f bar

rels

per

day

1995 2000 2005

7000

8000

9000

1000

0

Page 64: Advances in automatic time series forecasting

Examples

fit <- tbats(callcentre)fcast <- forecast(fit)plot(fcast)

Advances in automatic time series forecasting Time series with complex seasonality 25

Forecasts from TBATS(1, 3,1, 0.987, <169,5>, <845,3>)

5 minute intervals

Num

ber

of c

all a

rriv

als

010

020

030

040

050

0

3 March 17 March 31 March 14 April 28 April 12 May 26 May 9 June

Page 65: Advances in automatic time series forecasting

Examples

fit <- tbats(turk)fcast <- forecast(fit)plot(fcast)

Advances in automatic time series forecasting Time series with complex seasonality 26

Forecasts from TBATS(0, 5,3, 0.997, <7,3>, <354.37,12>, <365.25,4>)

Days

Ele

ctric

ity d

eman

d (G

W)

2000 2002 2004 2006 2008 2010

1015

2025

Page 66: Advances in automatic time series forecasting

References

Automatic algorithm described inDe Livera, Hyndman, Snyder (2011).“Forecasting time series with complex seasonalpatterns using exponential smoothing”. Journalof the American Statistical Association106(496), 1513–1527.

Slightly improved algorithm implemented inHyndman (2012). forecast: Forecastingfunctions for time series.cran.r-project.org/package=forecast.

More work required!

Advances in automatic time series forecasting Time series with complex seasonality 27

Page 67: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Hierarchical and grouped time series 28

Page 68: Advances in automatic time series forecasting

Introduction

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Examples

Manufacturing product hierarchies

Pharmaceutical sales

Net labour turnover

Advances in automatic time series forecasting Hierarchical and grouped time series 29

Page 69: Advances in automatic time series forecasting

Introduction

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Examples

Manufacturing product hierarchies

Pharmaceutical sales

Net labour turnover

Advances in automatic time series forecasting Hierarchical and grouped time series 29

Page 70: Advances in automatic time series forecasting

Introduction

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Examples

Manufacturing product hierarchies

Pharmaceutical sales

Net labour turnover

Advances in automatic time series forecasting Hierarchical and grouped time series 29

Page 71: Advances in automatic time series forecasting

Introduction

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Examples

Manufacturing product hierarchies

Pharmaceutical sales

Net labour turnover

Advances in automatic time series forecasting Hierarchical and grouped time series 29

Page 72: Advances in automatic time series forecasting

Hierarchical/grouped time series

A hierarchical time series is a collection ofseveral time series that are linked together in ahierarchical structure.

A grouped time series is a collection of timeseries that are aggregated in a number ofnon-hierarchical ways.

Example: daily numbers of calls to HP call centresare grouped by product type and location of callcentre.

Forecasts should be “aggregate consistent”,unbiased, minimum variance.

How to compute forecast intervals?Advances in automatic time series forecasting Hierarchical and grouped time series 30

Page 73: Advances in automatic time series forecasting

Hierarchical/grouped time series

A hierarchical time series is a collection ofseveral time series that are linked together in ahierarchical structure.

A grouped time series is a collection of timeseries that are aggregated in a number ofnon-hierarchical ways.

Example: daily numbers of calls to HP call centresare grouped by product type and location of callcentre.

Forecasts should be “aggregate consistent”,unbiased, minimum variance.

How to compute forecast intervals?Advances in automatic time series forecasting Hierarchical and grouped time series 30

Page 74: Advances in automatic time series forecasting

Hierarchical/grouped time series

A hierarchical time series is a collection ofseveral time series that are linked together in ahierarchical structure.

A grouped time series is a collection of timeseries that are aggregated in a number ofnon-hierarchical ways.

Example: daily numbers of calls to HP call centresare grouped by product type and location of callcentre.

Forecasts should be “aggregate consistent”,unbiased, minimum variance.

How to compute forecast intervals?Advances in automatic time series forecasting Hierarchical and grouped time series 30

Page 75: Advances in automatic time series forecasting

Hierarchical/grouped time series

A hierarchical time series is a collection ofseveral time series that are linked together in ahierarchical structure.

A grouped time series is a collection of timeseries that are aggregated in a number ofnon-hierarchical ways.

Example: daily numbers of calls to HP call centresare grouped by product type and location of callcentre.

Forecasts should be “aggregate consistent”,unbiased, minimum variance.

How to compute forecast intervals?Advances in automatic time series forecasting Hierarchical and grouped time series 30

Page 76: Advances in automatic time series forecasting

Hierarchical/grouped time series

A hierarchical time series is a collection ofseveral time series that are linked together in ahierarchical structure.

A grouped time series is a collection of timeseries that are aggregated in a number ofnon-hierarchical ways.

Example: daily numbers of calls to HP call centresare grouped by product type and location of callcentre.

Forecasts should be “aggregate consistent”,unbiased, minimum variance.

How to compute forecast intervals?Advances in automatic time series forecasting Hierarchical and grouped time series 30

Page 77: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 78: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 79: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Y t = [Yt, YA,t, YB,t, YC,t]′ =

1 1 11 0 00 1 00 0 1

YA,tYB,tYC,t

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 80: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Y t = [Yt, YA,t, YB,t, YC,t]′ =

1 1 11 0 00 1 00 0 1

︸ ︷︷ ︸

S

YA,tYB,tYC,t

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 81: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Y t = [Yt, YA,t, YB,t, YC,t]′ =

1 1 11 0 00 1 00 0 1

︸ ︷︷ ︸

S

YA,tYB,tYC,t

︸ ︷︷ ︸

YK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 82: Advances in automatic time series forecasting

Notation

Total

A B C

K : number of levels inhierarchy (excl. Total).

Y t = [Yt, YA,t, YB,t, YC,t]′ =

1 1 11 0 00 1 00 0 1

︸ ︷︷ ︸

S

YA,tYB,tYC,t

︸ ︷︷ ︸

YK,tY t = SYK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 31

Yt : observed aggregate of allseries at time t.

YX,t : observation on series X attime t.

Y i,t : vector of all series at level iin time t.

Y t = [Yt,Y1,t, . . . ,YK,t]′

Page 83: Advances in automatic time series forecasting

Hierarchical dataTotal

A

AX AY AZ

B

BX BY BZ

C

CX CY CZ

Y t =

YtYA,tYB,tYC,tYAX,tYAY,tYAZ,tYBX,tYBY,tYBZ,tYCX,tYCY,tYCZ,t

=

1 1 1 1 1 1 1 1 11 1 1 0 0 0 0 0 00 0 0 1 1 1 0 0 00 0 0 0 0 0 1 1 11 0 0 0 0 0 0 0 00 1 0 0 0 0 0 0 00 0 1 0 0 0 0 0 00 0 0 1 0 0 0 0 00 0 0 0 1 0 0 0 00 0 0 0 0 1 0 0 00 0 0 0 0 0 1 0 00 0 0 0 0 0 0 1 00 0 0 0 0 0 0 0 1

︸ ︷︷ ︸

S

YAX,tYAY,tYAZ,tYBX,tYBY,tYBZ,tYCX,tYCY,tYCZ,t

︸ ︷︷ ︸

YK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 32

Page 84: Advances in automatic time series forecasting

Hierarchical dataTotal

A

AX AY AZ

B

BX BY BZ

C

CX CY CZ

Y t =

YtYA,tYB,tYC,tYAX,tYAY,tYAZ,tYBX,tYBY,tYBZ,tYCX,tYCY,tYCZ,t

=

1 1 1 1 1 1 1 1 11 1 1 0 0 0 0 0 00 0 0 1 1 1 0 0 00 0 0 0 0 0 1 1 11 0 0 0 0 0 0 0 00 1 0 0 0 0 0 0 00 0 1 0 0 0 0 0 00 0 0 1 0 0 0 0 00 0 0 0 1 0 0 0 00 0 0 0 0 1 0 0 00 0 0 0 0 0 1 0 00 0 0 0 0 0 0 1 00 0 0 0 0 0 0 0 1

︸ ︷︷ ︸

S

YAX,tYAY,tYAZ,tYBX,tYBY,tYBZ,tYCX,tYCY,tYCZ,t

︸ ︷︷ ︸

YK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 32

Page 85: Advances in automatic time series forecasting

Grouped data

Total

A

AX AY

B

BX BY

Total

X

AX BX

Y

AY BY

Y t =

YtYA,tYB,tYX,tYY,tYAX,tYAY,tYBX,tYBY,t

=

1 1 1 11 1 0 00 0 1 11 0 1 00 1 0 11 0 0 00 1 0 00 0 1 00 0 0 1

︸ ︷︷ ︸

S

YAX,tYAY,tYBX,tYBY,t

︸ ︷︷ ︸

YK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 33

Page 86: Advances in automatic time series forecasting

Grouped data

Total

A

AX AY

B

BX BY

Total

X

AX BX

Y

AY BY

Y t =

YtYA,tYB,tYX,tYY,tYAX,tYAY,tYBX,tYBY,t

=

1 1 1 11 1 0 00 0 1 11 0 1 00 1 0 11 0 0 00 1 0 00 0 1 00 0 0 1

︸ ︷︷ ︸

S

YAX,tYAY,tYBX,tYBY,t

︸ ︷︷ ︸

YK,t

Advances in automatic time series forecasting Hierarchical and grouped time series 33

Page 87: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 88: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 89: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 90: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 91: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 92: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 93: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 94: Advances in automatic time series forecasting

Forecasts

Key idea: forecast reconciliation

å Ignore structural constraints and forecast everyseries of interest independently.

å Adjust forecasts to impose constraints.

Let Yn(h) be vector of initial forecasts for horizon h,made at time n, stacked in same order as Y t.

Y t = SYK,t . So Yn(h) = Sβn(h) + εh .

βn(h) = E[YK,n+h | Y1, . . . ,Yn].εh has zero mean and covariance matrix Σh.Estimate βn(h) using GLS?

Revised forecasts: Yn(h) = Sβn(h)Advances in automatic time series forecasting Hierarchical and grouped time series 34

Page 95: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 96: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 97: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 98: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 99: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 100: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 101: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 102: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 103: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 104: Advances in automatic time series forecasting

Optimal combination forecastsYn(h) = Sβn(h) = S(S′Σ†hS)−1S′Σ†hYn(h)

Revised forecasts Base forecasts

Σ†h is generalized inverse of Σh.

Problem: Don’t know Σh and hard to estimate.

Solution: Assume εh ≈ SεK,h where εK,h is theforecast error at bottom level.Then Σh ≈ SΩhS′ where Ωh = Var(εK,h).If Moore-Penrose generalized inverse used,then

(S′Σ†S)−1S′Σ† = (S′S)−1S′.

Yn(h) = S(S′S)−1S′Yn(h)

Advances in automatic time series forecasting Hierarchical and grouped time series 35

Page 105: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 106: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 107: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 108: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 109: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 110: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Page 111: Advances in automatic time series forecasting

Optimal combination forecasts

Yn(h) = S(S′S)−1S′Yn(h)

GLS =OLS.

Optimal weighted average of base forecasts.

Computational difficulties in big hierarchies dueto size of S matrix.

Optimal weights are S(S′S)−1S′

Weights are independent of the data!

Total

A B C

Advances in automatic time series forecasting Hierarchical and grouped time series 36

Weights: S(S′S)−1S′ =0.75 0.25 0.25 0.250.25 0.75 −0.25 −0.250.25 −0.25 0.75 −0.250.25 −0.25 −0.25 0.75

Page 112: Advances in automatic time series forecasting

Optimal combination forecasts

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Weights: S(S′S)−1S′ =

0.69 0.23 0.23 0.23 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.080.23 0.58 −0.17 −0.17 0.19 0.19 0.19 −0.06 −0.06 −0.06 −0.06 −0.06 −0.060.23 −0.17 0.58 −0.17 −0.06 −0.06 −0.06 0.19 0.19 0.19 −0.06 −0.06 −0.060.23 −0.17 −0.17 0.58 −0.06 −0.06 −0.06 −0.06 −0.06 −0.06 0.19 0.19 0.190.08 0.19 −0.06 −0.06 0.73 −0.27 −0.27 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 0.19 −0.06 −0.06 −0.27 0.73 −0.27 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 0.19 −0.06 −0.06 −0.27 −0.27 0.73 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 0.73 −0.27 −0.27 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 −0.27 0.73 −0.27 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 −0.27 −0.27 0.73 −0.02 −0.02 −0.020.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 0.73 −0.27 −0.270.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 −0.27 0.73 −0.270.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 −0.27 −0.27 0.73

Advances in automatic time series forecasting Hierarchical and grouped time series 37

Page 113: Advances in automatic time series forecasting

Optimal combination forecasts

Total

A

AA AB AC

B

BA BB BC

C

CA CB CC

Weights: S(S′S)−1S′ =

0.69 0.23 0.23 0.23 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.080.23 0.58 −0.17 −0.17 0.19 0.19 0.19 −0.06 −0.06 −0.06 −0.06 −0.06 −0.060.23 −0.17 0.58 −0.17 −0.06 −0.06 −0.06 0.19 0.19 0.19 −0.06 −0.06 −0.060.23 −0.17 −0.17 0.58 −0.06 −0.06 −0.06 −0.06 −0.06 −0.06 0.19 0.19 0.190.08 0.19 −0.06 −0.06 0.73 −0.27 −0.27 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 0.19 −0.06 −0.06 −0.27 0.73 −0.27 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 0.19 −0.06 −0.06 −0.27 −0.27 0.73 −0.02 −0.02 −0.02 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 0.73 −0.27 −0.27 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 −0.27 0.73 −0.27 −0.02 −0.02 −0.020.08 −0.06 0.19 −0.06 −0.02 −0.02 −0.02 −0.27 −0.27 0.73 −0.02 −0.02 −0.020.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 0.73 −0.27 −0.270.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 −0.27 0.73 −0.270.08 −0.06 −0.06 0.19 −0.02 −0.02 −0.02 −0.02 −0.02 −0.02 −0.27 −0.27 0.73

Advances in automatic time series forecasting Hierarchical and grouped time series 37

Page 114: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 115: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 116: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 117: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 118: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 119: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Page 120: Advances in automatic time series forecasting

Features and problemsYn(h) = S(S′S)−1S′Yn(h)

Var[Yn(h)] = SΩhS′ = Σh.

Advances in automatic time series forecasting Hierarchical and grouped time series 38

Covariates can be included in base forecasts.Point forecasts are always consistent.Need to estimate Ωh to produce prediction intervals.Very simple and flexible method. Can work with anyhierarchical or grouped time series.

Hyndman, Ahmed, Athanasopoulos, Shang (2011).“Optimal combination forecasts for hierarchicaltime series”. Computational Statistics and DataAnalysis 55(9), 2579–2589Hyndman, Ahmed, Shang (2011). hts: Hierarchicaltime series. cran.r-project.org/package=hts

Page 121: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Functional time series 39

Page 122: Advances in automatic time series forecasting

Fertility rates

Advances in automatic time series forecasting Functional time series 40

Page 123: Advances in automatic time series forecasting

Some notationLet yt,x be the observed data in period t at age x,t = 1, . . . ,n.

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 41

Estimate ft(x) using penalized regression splines.

Estimate µ(x) as mean ft(x) across years.

Estimate βt,k and φk(x) using functional (weighted)principal components.

εt,xiid∼ N(0,1) and et(x)

iid∼ N(0, v(x)).

Page 124: Advances in automatic time series forecasting

Some notationLet yt,x be the observed data in period t at age x,t = 1, . . . ,n.

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 41

Estimate ft(x) using penalized regression splines.

Estimate µ(x) as mean ft(x) across years.

Estimate βt,k and φk(x) using functional (weighted)principal components.

εt,xiid∼ N(0,1) and et(x)

iid∼ N(0, v(x)).

Page 125: Advances in automatic time series forecasting

Some notationLet yt,x be the observed data in period t at age x,t = 1, . . . ,n.

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 41

Estimate ft(x) using penalized regression splines.

Estimate µ(x) as mean ft(x) across years.

Estimate βt,k and φk(x) using functional (weighted)principal components.

εt,xiid∼ N(0,1) and et(x)

iid∼ N(0, v(x)).

Page 126: Advances in automatic time series forecasting

Some notationLet yt,x be the observed data in period t at age x,t = 1, . . . ,n.

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 41

Estimate ft(x) using penalized regression splines.

Estimate µ(x) as mean ft(x) across years.

Estimate βt,k and φk(x) using functional (weighted)principal components.

εt,xiid∼ N(0,1) and et(x)

iid∼ N(0, v(x)).

Page 127: Advances in automatic time series forecasting

Some notationLet yt,x be the observed data in period t at age x,t = 1, . . . ,n.

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 41

Estimate ft(x) using penalized regression splines.

Estimate µ(x) as mean ft(x) across years.

Estimate βt,k and φk(x) using functional (weighted)principal components.

εt,xiid∼ N(0,1) and et(x)

iid∼ N(0, v(x)).

Page 128: Advances in automatic time series forecasting

Fertility application

Advances in automatic time series forecasting Functional time series 42

15 20 25 30 35 40 45 50

050

100

150

200

250

Australia fertility rates (1921−2006)

Age

Fer

tility

rat

e

Page 129: Advances in automatic time series forecasting

Fertility model

Advances in automatic time series forecasting Functional time series 43

15 20 25 30 35 40 45 50

05

1015

Age

Mu

15 20 25 30 35 40 45 50

0.00

0.10

0.20

0.30

AgeP

hi 1

Year

Bet

a 1

1920 1960 2000

−20

−10

05

10

15 20 25 30 35 40 45 50

−0.

2−

0.1

0.0

0.1

0.2

Age

Phi

2Year

Bet

a 2

1920 1960 2000

−10

010

2030

Page 130: Advances in automatic time series forecasting

Functional time series model

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

The eigenfunctions φk(x) show the mainregions of variation.The scores βt,k are uncorrelated byconstruction. So we can forecast each βt,k usinga univariate time series model.Univariate ARIMA models used for automaticforecasting of scores.

Advances in automatic time series forecasting Functional time series 44

Page 131: Advances in automatic time series forecasting

Functional time series model

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

The eigenfunctions φk(x) show the mainregions of variation.The scores βt,k are uncorrelated byconstruction. So we can forecast each βt,k usinga univariate time series model.Univariate ARIMA models used for automaticforecasting of scores.

Advances in automatic time series forecasting Functional time series 44

Page 132: Advances in automatic time series forecasting

Functional time series model

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

The eigenfunctions φk(x) show the mainregions of variation.The scores βt,k are uncorrelated byconstruction. So we can forecast each βt,k usinga univariate time series model.Univariate ARIMA models used for automaticforecasting of scores.

Advances in automatic time series forecasting Functional time series 44

Page 133: Advances in automatic time series forecasting

Functional time series model

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

The eigenfunctions φk(x) show the mainregions of variation.The scores βt,k are uncorrelated byconstruction. So we can forecast each βt,k usinga univariate time series model.Univariate ARIMA models used for automaticforecasting of scores.

Advances in automatic time series forecasting Functional time series 44

Page 134: Advances in automatic time series forecasting

Forecasts

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

Advances in automatic time series forecasting Functional time series 45

Page 135: Advances in automatic time series forecasting

Forecasts

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

where vn+h,k = Var(βn+h,k | β1,k, . . . , βn,k)and y = [y1,x, . . . , yn,x].

Advances in automatic time series forecasting Functional time series 45

E[yn+h,x | y] = µ(x) +K∑

k=1

βn+h,k φk(x)

Var[yn+h,x | y] = σ2µ(x) +

K∑k=1

vn+h,k φ2k(x) + σ2

t (x) + v(x)

Page 136: Advances in automatic time series forecasting

Forecasts of ft(x)

Advances in automatic time series forecasting Functional time series 46

15 20 25 30 35 40 45 50

050

100

150

200

250

Australia fertility rates (1921−2006)

Age

Fer

tility

rat

e

Page 137: Advances in automatic time series forecasting

Forecasts of ft(x)

Advances in automatic time series forecasting Functional time series 46

15 20 25 30 35 40 45 50

050

100

150

200

250

Australia fertility rates (1921−2006)

Age

Fer

tility

rat

e

Page 138: Advances in automatic time series forecasting

Forecasts of ft(x)

Advances in automatic time series forecasting Functional time series 46

15 20 25 30 35 40 45 50

050

100

150

200

250

Australia fertility rates (1921−2006)

Age

Fer

tility

rat

e

Page 139: Advances in automatic time series forecasting

Forecasts of ft(x)

Advances in automatic time series forecasting Functional time series 46

15 20 25 30 35 40 45 50

050

100

150

200

250

Australia fertility rates (1921−2006)

Age

Fer

tility

rat

e

80% prediction intervals

Page 140: Advances in automatic time series forecasting

References

Hyndman, Ullah (2007). “Robust forecasting ofmortality and fertility rates: A functional dataapproach”. Computational Statistics and DataAnalysis 51(10), 4942–4956

Hyndman, Shang (2009). “Forecastingfunctional time series (with discussion)”.Journal of the Korean Statistical Society 38(3),199–221

Hyndman (2012). demography: Forecastingmortality, fertility, migration and populationdata.cran.r-project.org/package=demography

Advances in automatic time series forecasting Functional time series 47

Page 141: Advances in automatic time series forecasting

Outline

1 Motivation

2 Exponential smoothing

3 ARIMA modelling

4 Time series with complex seasonality

5 Hierarchical and grouped time series

6 Functional time series

7 Grouped functional time series

Advances in automatic time series forecasting Grouped functional time series 48

Page 142: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 143: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 144: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 145: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 146: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 147: Advances in automatic time series forecasting

Forecasting groups

Let ft,j(x) be the smoothed mortality rate for age xin group j in year t.

Groups may be males and females.

Groups may be states within a country.

Expected that groups will behave similarly.

Coherent forecasts do not diverge over time.

Existing functional models do not imposecoherence.

Advances in automatic time series forecasting Grouped functional time series 49

Page 148: Advances in automatic time series forecasting

Forecasting the coefficients

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

We use ARIMA models for each coefficientβ1,j,k, . . . , βn,j,k.The ARIMA models are non-stationary for thefirst few coefficients (k = 1,2)

Non-stationary ARIMA forecasts will diverge.Hence the mortality forecasts are not coherent.

Advances in automatic time series forecasting Grouped functional time series 50

Page 149: Advances in automatic time series forecasting

Forecasting the coefficients

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

We use ARIMA models for each coefficientβ1,j,k, . . . , βn,j,k.The ARIMA models are non-stationary for thefirst few coefficients (k = 1,2)

Non-stationary ARIMA forecasts will diverge.Hence the mortality forecasts are not coherent.

Advances in automatic time series forecasting Grouped functional time series 50

Page 150: Advances in automatic time series forecasting

Forecasting the coefficients

yt,x = ft(x) + σt(x)εt,x

ft(x) = µ(x) +K∑

k=1

βt,k φk(x) + et(x)

We use ARIMA models for each coefficientβ1,j,k, . . . , βn,j,k.The ARIMA models are non-stationary for thefirst few coefficients (k = 1,2)

Non-stationary ARIMA forecasts will diverge.Hence the mortality forecasts are not coherent.

Advances in automatic time series forecasting Grouped functional time series 50

Page 151: Advances in automatic time series forecasting

Male fts model

Advances in automatic time series forecasting Grouped functional time series 51

0 20 40 60 80

−8

−6

−4

−2

Age

µ M(x

)

0 20 40 60 80

0.1

0.2

0.3

0.4

Age

φ 1(x

)

Year

β t1

1960 2000

−6

−4

−2

02

0 20 40 60 80

−0.

6−

0.2

0.2

0.4

Age

φ 2(x

)

Year

β t2

1960 2000

−0.

6−

0.2

0.0

0.2

0 20 40 60 80

−0.

4−

0.2

0.0

0.2

0.4

Age

φ 3(x

)

Year

β t3

1960 2000

−0.

4−

0.2

0.0

0.2

Australian male death rates

Page 152: Advances in automatic time series forecasting

Female fts model

Advances in automatic time series forecasting Grouped functional time series 52

0 20 40 60 80

−8

−6

−4

−2

Age

µ F(x

)

0 20 40 60 80

0.1

0.2

0.3

0.4

Age

φ 1(x

)

Year

β t1

1960 2000

−4

−2

02

0 20 40 60 80

−0.

4−

0.2

0.0

0.2

0.4

Age

φ 2(x

)

Year

β t2

1960 2000

−0.

5−

0.3

−0.

10.

1

0 20 40 60 80

−0.

4−

0.2

0.0

0.2

Age

φ 3(x

)

Year

β t3

1960 2000

−0.

4−

0.2

0.0

0.2

Australian female death rates

Page 153: Advances in automatic time series forecasting

Australian mortality forecasts

Advances in automatic time series forecasting Grouped functional time series 53

0 20 40 60 80 100

−10

−8

−6

−4

−2

(a) Males

Age

Log

deat

h ra

te

0 20 40 60 80 100

−10

−8

−6

−4

−2

(b) Females

Age

Log

deat

h ra

te

Page 154: Advances in automatic time series forecasting

Mortality product and ratios

Key idea

Model the geometric mean and the mortality ratioinstead of the individual rates for each sexseparately.

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

Product and ratio are approximatelyindependent

Ratio should be stationary (for coherence) butproduct can be non-stationary.

Advances in automatic time series forecasting Grouped functional time series 54

Page 155: Advances in automatic time series forecasting

Mortality product and ratios

Key idea

Model the geometric mean and the mortality ratioinstead of the individual rates for each sexseparately.

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

Product and ratio are approximatelyindependent

Ratio should be stationary (for coherence) butproduct can be non-stationary.

Advances in automatic time series forecasting Grouped functional time series 54

Page 156: Advances in automatic time series forecasting

Mortality product and ratios

Key idea

Model the geometric mean and the mortality ratioinstead of the individual rates for each sexseparately.

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

Product and ratio are approximatelyindependent

Ratio should be stationary (for coherence) butproduct can be non-stationary.

Advances in automatic time series forecasting Grouped functional time series 54

Page 157: Advances in automatic time series forecasting

Mortality product and ratios

Key idea

Model the geometric mean and the mortality ratioinstead of the individual rates for each sexseparately.

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

Product and ratio are approximatelyindependent

Ratio should be stationary (for coherence) butproduct can be non-stationary.

Advances in automatic time series forecasting Grouped functional time series 54

Page 158: Advances in automatic time series forecasting

Mortality rates

Advances in automatic time series forecasting Grouped functional time series 55

Page 159: Advances in automatic time series forecasting

Mortality rates

Advances in automatic time series forecasting Grouped functional time series 56

Page 160: Advances in automatic time series forecasting

Model product and ratios

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt(x)] = µr(x) +L∑`=1

γt,`ψ`(x) + wt(x).

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).No restrictions for βt,1, . . . , βt,K.Forecasts: fn+h|n,M(x) = pn+h|n(x)rn+h|n(x)

fn+h|n,F(x) = pn+h|n(x)/rn+h|n(x).

Advances in automatic time series forecasting Grouped functional time series 57

Page 161: Advances in automatic time series forecasting

Model product and ratios

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt(x)] = µr(x) +L∑`=1

γt,`ψ`(x) + wt(x).

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).No restrictions for βt,1, . . . , βt,K.Forecasts: fn+h|n,M(x) = pn+h|n(x)rn+h|n(x)

fn+h|n,F(x) = pn+h|n(x)/rn+h|n(x).

Advances in automatic time series forecasting Grouped functional time series 57

Page 162: Advances in automatic time series forecasting

Model product and ratios

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt(x)] = µr(x) +L∑`=1

γt,`ψ`(x) + wt(x).

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).No restrictions for βt,1, . . . , βt,K.Forecasts: fn+h|n,M(x) = pn+h|n(x)rn+h|n(x)

fn+h|n,F(x) = pn+h|n(x)/rn+h|n(x).

Advances in automatic time series forecasting Grouped functional time series 57

Page 163: Advances in automatic time series forecasting

Model product and ratios

pt(x) =√ft,M(x)ft,F(x) and rt(x) =

√ft,M(x)

/ft,F(x).

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt(x)] = µr(x) +L∑`=1

γt,`ψ`(x) + wt(x).

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).No restrictions for βt,1, . . . , βt,K.Forecasts: fn+h|n,M(x) = pn+h|n(x)rn+h|n(x)

fn+h|n,F(x) = pn+h|n(x)/rn+h|n(x).

Advances in automatic time series forecasting Grouped functional time series 57

Page 164: Advances in automatic time series forecasting

Product model

Advances in automatic time series forecasting Grouped functional time series 58

0 20 40 60 80

−8

−6

−4

−2

Age

µ P(x

)

0 20 40 60 80

0.1

0.2

0.3

0.4

Age

φ 1(x

)

Year

β t1

1960 2000

−4

−2

02

0 20 40 60 80

−0.

4−

0.2

0.0

0.2

0.4

Age

φ 2(x

)

Year

β t2

1960 2000

−0.

6−

0.2

0.0

0.2

0 20 40 60 80

−0.

4−

0.2

0.0

0.2

Age

φ 3(x

)

Year

β t3

1960 2000

−0.

20.

00.

10.

20.

3

Page 165: Advances in automatic time series forecasting

Ratio model

Advances in automatic time series forecasting Grouped functional time series 59

0 20 40 60 80

0.1

0.2

0.3

0.4

0.5

Age

µ R(x

)

0 20 40 60 80

−0.

20.

00.

20.

4

Age

φ 1(x

)

Year

β t1

1960 2000

−0.

4−

0.2

0.0

0.2

0 20 40 60 80

0.0

0.2

0.4

0.6

Age

φ 2(x

)

Year

β t2

1960 2000

−0.

2−

0.1

0.0

0.1

0.2

0 20 40 60 80

−0.

40.

00.

40.

8

Age

φ 3(x

)

Year

β t3

1960 2000

−0.

100.

000.

10

Page 166: Advances in automatic time series forecasting

Product forecasts

Advances in automatic time series forecasting Grouped functional time series 60

0 20 40 60 80 100

−10

−8

−6

−4

−2

Age

Log

of g

eom

etric

mea

n de

ath

rate

Page 167: Advances in automatic time series forecasting

Ratio forecasts

Advances in automatic time series forecasting Grouped functional time series 61

0 20 40 60 80 100

1.0

1.5

2.0

2.5

3.0

3.5

4.0

Age

Sex

rat

io: M

/F

Page 168: Advances in automatic time series forecasting

Coherent forecasts

Advances in automatic time series forecasting Grouped functional time series 62

0 20 40 60 80 100

−10

−8

−6

−4

−2

(a) Males

Age

Log

deat

h ra

te

0 20 40 60 80 100

−10

−8

−6

−4

−2

(b) Females

Age

Log

deat

h ra

te

Page 169: Advances in automatic time series forecasting

Ratio forecasts

Advances in automatic time series forecasting Grouped functional time series 63

0 20 40 60 80 100

1.0

1.5

2.0

2.5

3.0

3.5

4.0

Independent forecasts

Age

Sex

rat

io o

f rat

es: M

/F

0 20 40 60 80 100

1.0

1.5

2.0

2.5

3.0

3.5

4.0

Coherent forecasts

Age

Sex

rat

io o

f rat

es: M

/F

Page 170: Advances in automatic time series forecasting

Life expectancy forecasts

Advances in automatic time series forecasting Grouped functional time series 64

Life expectancy forecasts

Year

Age

1960 1980 2000 2020

7075

8085

1960 1980 2000 2020

7075

8085Life expectancy difference: F−M

Year

Num

ber

of y

ears

1960 1980 2000 2020

24

68

Page 171: Advances in automatic time series forecasting

Coherent forecasts for J groups

pt(x) = [ft,1(x)ft,2(x) · · · ft,J(x)]1/J

and rt,j(x) = ft,j(x)/pt(x),

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt,j(x)] = µr,j(x) +L∑

l=1

γt,l,jψl,j(x) + wt,j(x).

Advances in automatic time series forecasting Grouped functional time series 65

pt(x) and all rt,j(x)are approximatelyindependent.

Ratios satisfy constraintrt,1(x)rt,2(x) · · · rt,J(x) = 1.

log[ft,j(x)] = log[pt(x)rt,j(x)]

Page 172: Advances in automatic time series forecasting

Coherent forecasts for J groups

pt(x) = [ft,1(x)ft,2(x) · · · ft,J(x)]1/J

and rt,j(x) = ft,j(x)/pt(x),

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt,j(x)] = µr,j(x) +L∑

l=1

γt,l,jψl,j(x) + wt,j(x).

Advances in automatic time series forecasting Grouped functional time series 65

pt(x) and all rt,j(x)are approximatelyindependent.

Ratios satisfy constraintrt,1(x)rt,2(x) · · · rt,J(x) = 1.

log[ft,j(x)] = log[pt(x)rt,j(x)]

Page 173: Advances in automatic time series forecasting

Coherent forecasts for J groups

pt(x) = [ft,1(x)ft,2(x) · · · ft,J(x)]1/J

and rt,j(x) = ft,j(x)/pt(x),

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt,j(x)] = µr,j(x) +L∑

l=1

γt,l,jψl,j(x) + wt,j(x).

Advances in automatic time series forecasting Grouped functional time series 65

pt(x) and all rt,j(x)are approximatelyindependent.

Ratios satisfy constraintrt,1(x)rt,2(x) · · · rt,J(x) = 1.

log[ft,j(x)] = log[pt(x)rt,j(x)]

Page 174: Advances in automatic time series forecasting

Coherent forecasts for J groups

pt(x) = [ft,1(x)ft,2(x) · · · ft,J(x)]1/J

and rt,j(x) = ft,j(x)/pt(x),

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt,j(x)] = µr,j(x) +L∑

l=1

γt,l,jψl,j(x) + wt,j(x).

Advances in automatic time series forecasting Grouped functional time series 65

pt(x) and all rt,j(x)are approximatelyindependent.

Ratios satisfy constraintrt,1(x)rt,2(x) · · · rt,J(x) = 1.

log[ft,j(x)] = log[pt(x)rt,j(x)]

Page 175: Advances in automatic time series forecasting

Coherent forecasts for J groups

pt(x) = [ft,1(x)ft,2(x) · · · ft,J(x)]1/J

and rt,j(x) = ft,j(x)/pt(x),

log[pt(x)] = µp(x) +K∑

k=1

βt,kφk(x) + et(x)

log[rt,j(x)] = µr,j(x) +L∑

l=1

γt,l,jψl,j(x) + wt,j(x).

Advances in automatic time series forecasting Grouped functional time series 65

pt(x) and all rt,j(x)are approximatelyindependent.

Ratios satisfy constraintrt,1(x)rt,2(x) · · · rt,J(x) = 1.

log[ft,j(x)] = log[pt(x)rt,j(x)]

Page 176: Advances in automatic time series forecasting

Coherent forecasts for J groups

µj(x) = µp(x) + µr,j(x) is group mean

zt,j(x) = et(x) + wt,j(x) is error term.

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).

No restrictions for βt,1, . . . , βt,K.

Advances in automatic time series forecasting Grouped functional time series 66

log[ft,j(x)] = log[pt(x)rt,j(x)] = log[pt(x)] + log[rt,j]

= µj(x) +K∑

k=1

βt,kφk(x) +L∑`=1

γt,`,jψ`,j(x) + zt,j(x)

Page 177: Advances in automatic time series forecasting

Coherent forecasts for J groups

µj(x) = µp(x) + µr,j(x) is group mean

zt,j(x) = et(x) + wt,j(x) is error term.

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).

No restrictions for βt,1, . . . , βt,K.

Advances in automatic time series forecasting Grouped functional time series 66

log[ft,j(x)] = log[pt(x)rt,j(x)] = log[pt(x)] + log[rt,j]

= µj(x) +K∑

k=1

βt,kφk(x) +L∑`=1

γt,`,jψ`,j(x) + zt,j(x)

Page 178: Advances in automatic time series forecasting

Coherent forecasts for J groups

µj(x) = µp(x) + µr,j(x) is group mean

zt,j(x) = et(x) + wt,j(x) is error term.

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).

No restrictions for βt,1, . . . , βt,K.

Advances in automatic time series forecasting Grouped functional time series 66

log[ft,j(x)] = log[pt(x)rt,j(x)] = log[pt(x)] + log[rt,j]

= µj(x) +K∑

k=1

βt,kφk(x) +L∑`=1

γt,`,jψ`,j(x) + zt,j(x)

Page 179: Advances in automatic time series forecasting

Coherent forecasts for J groups

µj(x) = µp(x) + µr,j(x) is group mean

zt,j(x) = et(x) + wt,j(x) is error term.

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).

No restrictions for βt,1, . . . , βt,K.

Advances in automatic time series forecasting Grouped functional time series 66

log[ft,j(x)] = log[pt(x)rt,j(x)] = log[pt(x)] + log[rt,j]

= µj(x) +K∑

k=1

βt,kφk(x) +L∑`=1

γt,`,jψ`,j(x) + zt,j(x)

Page 180: Advances in automatic time series forecasting

Coherent forecasts for J groups

µj(x) = µp(x) + µr,j(x) is group mean

zt,j(x) = et(x) + wt,j(x) is error term.

γt,` restricted to be stationary processes:either ARMA(p,q) or ARFIMA(p,d,q).

No restrictions for βt,1, . . . , βt,K.

Advances in automatic time series forecasting Grouped functional time series 66

log[ft,j(x)] = log[pt(x)rt,j(x)] = log[pt(x)] + log[rt,j]

= µj(x) +K∑

k=1

βt,kφk(x) +L∑`=1

γt,`,jψ`,j(x) + zt,j(x)

Page 181: Advances in automatic time series forecasting

References

Hyndman, Booth, Yasmeen (2012). “Coherentmortality forecasting: the product-ratio methodwith functional time series models”.Demography, to appear

Hyndman (2012). demography: Forecastingmortality, fertility, migration and populationdata.cran.r-project.org/package=demography

Advances in automatic time series forecasting Grouped functional time series 67

Page 182: Advances in automatic time series forecasting

For further information

robjhyndman.com

Slides and references for this talk.

Links to all papers and books.

Links to R packages.

A blog about forecasting research.

Advances in automatic time series forecasting Grouped functional time series 68