57
Uncertainty in predictive modelling Nikolaos Kourentzes Lancaster University OR59 14/09/2017

Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Embed Size (px)

Citation preview

Page 1: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Uncertainty in predictive modelling

Nikolaos KourentzesLancaster University

OR59

14/09/2017

Page 2: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Agenda

1. Forecasting & uncertainty

2. Models, assumptions & uncertainty

3. Managing modelling uncertainty

4. Approach I: Point AIC

5. Approach II: Multiple Temporal Aggregation

2/46

Page 3: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Forecasting & decision making

Decision making in organisations has at its core an element of forecasting

Accurate forecasts lead to reduced uncertainty better decisions

Forecasts maybe implicit or explicit

Forecasts aims to provide information about the future, conditional on historical and current knowledge

Company targets and plans aim to provide direction towards a desirable future.

Present

Target

Forecast

Forecast

Difference between targets and forecasts, at different horizons, provide useful feedback

3/46

Page 4: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Forecasting & uncertainty

The great thing about forecasting is that you will get it wrong and that is fine most

probable outcome!

All forecasts come with uncertainties

➢ We try to identify and manage these uncertainties

4/46

Page 5: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Forecasting & uncertainty

One of the most important jumps in forecasting as a discipline has been to move from

method based forecasts to model based forecasts.

• Optimal (maximum likelihood) parameters & model selection.

• An explicit representation of the uncertainty of the forecasts.

But model based forecasting hides an insidious assumption: the specified model is true.

80% and 95%

prediction intervals

5/46

Page 6: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

True models & untrue assumptions

To better understand the problem let us consider the exponential smoothing (ETS) family of models

• Since invention countless advances and applications [Holt, 2004; Gardner, 2006]

• Recent survey: 32.1% of business forecasts done exclusively by ETS [Weller & Crone,

2012] – numerous more depend on some baseline ETS plus expert adjustments.

• Wide application: supply chain [Trapero et al., 2012], call centres [Taylor, 2008], electricity

load [Taylor, 2007], climate modelling [Fildes & Kourentzes, 2011], etc.

• Relatively good performance and attractive simplicity [Makridakis & Hibon, 2000]

Hyndman et al. [2002, 2008] embedded exponential smoothing within the state space

framework giving it a statistical rationale parameter estimation, model selection,

prediction intervals, etc.

At the core of everything is the maximum likelihood estimation (or similar cost).

6/46

Page 7: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

The Exponential Smoothing Family

None Additive Multiplicative

None

Additive

AdditiveDamped

Multiplicative

MultiplicativeDamped

Trend

Seasonality

tht

ttt

LF

FaaAL

)1(

11 tsttt LaSAL

stttt SLAS )1()(

ksttkt SLF

11 )1()( tttt TLLT

)( 1

1

t

t

tt T

L

AS

stS )1(

hstt

h

i

i

tht STLF

1

))(1( 11

tt

st

tt TLa

S

AaL

Use likelihood to find smoothing and initial values. Use some information criterion (AIC, AICc, BIC, etc) to choose the

appropriate model per series.

Page 8: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

True models & untrue assumptions

We optimise our models using MLE or (for ETS) equivalently minimise the

augmented sum of squared errors criterion:

Observe that the cost function is based on 1-step ahead errors.

If the postulated model is true there is no problem, but what happens if not?

For additive errors r(xt-1) = 1, so this is equal to the well known MSE:

8/46

Page 9: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

They used likelihood… they thought their postulated model was true

Now only a different cost function can save them!

Page 10: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

True models & untrue assumptions

Why is this such a problem?

• We are typically interested in forecasting more than 1-step ahead.

• If the model is true then it successfully describes the data for one- or any-

steps ahead, and the optimal parameters for one-step ahead are appropriate

for any forecast.

• If the model is not true then minimising the one-step ahead error results in

parameters that make the model (approximately) best for predicting one-

step ahead. But, if we were to predict 10-steps ahead then the parameters

are far from optimal and the forecast bound to large errors [Xia et al., 2011].

10/46

Page 11: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

True models & untrue assumptions

Instead of going into a statistical explanation, let us consider an intuitive one:

• We want to make a decision h-steps ahead, so we produce a t+h forecast.

Why should we optimise the model parameters for a short term objective

(t+1)?

• It is well accepted that short and long term predictions require different

methods and in turn parameters [Clements and Hendry, 1998; Chatfield, 2000].

• When was the last time you happily accepted your model as being true,

rather than a useful approximation? Well this invalidates the basic

assumption behind maximum likelihood estimation and in-turn predictive

model building.

11/46

Page 12: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Untrue models & uncertainty

What does this mean for our model based forecast uncertainty?

• Let us consider a very simple model, the Single Exponential Smoothing (SES),

or ETS(A,N,N) under the state-space naming.

• The variance (uncertainty) of the forecasts for multiple-steps ahead is given

by:

t+1 estimated variance model parameter forecast horizon

12/46

Page 13: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Untrue models & uncertainty

• If the model is untrue then the model parameter for t+1 and t+h will be different.

• So the uncertainty no longer varies simply due to the forecast horizon, but also due to

the smoothing parameter

• In short, the prediction intervals for t+h are wrong!

13/46

Page 14: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Uncertain models

• We established that forecast uncertainty is not “honest” about parameter uncertainty

and this is commonplace in practice (the model is not true).

• It has a further important implication:

• Model selection (or specification for regression type models) is often based on

likelihood based information criteria.

• and the likelihood assumes a true model, so eventually we choose models on

very uncertain grounds (or at least with different objectives than the ones they

are going to be used for!)

Number of model

parameters

Maximised double negative

log likelihood

14/46

Page 15: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A way forward: incorporating uncertainty in specification

• The double log negative log likelihood

eventually is a summary statistic that ignores any uncertainty (that is what the sums

do!)

• We could remove the sums and calculate a “point likelihood” that retains for each

point the uncertainty (not lost in the sums):

• From that we can write the “point AIC”, which is a vector (t = 1, … n) for each model.

15/46

Page 16: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A way forward: incorporating uncertainty in specification

• For a time series, using AIC we could have

• and on top of it the point AIC

The boxplots of pAIC visualise

the model selection

uncertainty!

16/46

Page 17: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A way forward: AIC with uncertainty

• So the model selection is transformed from choosing between single points (AIC

values, or CV statistics) choosing between distributions.

• If there is dominant distribution choose that model.

• If there is not any dominant one combine all top ones that there is no

evidence of difference.

17/46

Page 18: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A way forward: AIC with uncertainty

• Does it work? Test on three datasets (M3 competition, 3003 series; FMCG company

sales, 229 series; FRED inventory statistics, 323 series)

• Rolling origin evaluation using ETS model family

• Evaluate on AvRelMAE

18/46

Page 19: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A way forward: AIC with uncertainty

Best AIC

Best pAIC

Unweighted combination

AIC weighted combination

Top pAICdistributions

It always pays off to take into account the modelling uncertainty in

model selection! Improvements up to 5% from the same forecasts

Working paper available soonTM

19/46

Page 20: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Agenda

1. Forecasting & uncertainty

2. Models, assumptions & uncertainty

3. Managing modelling uncertainty

4. Approach I: Point AIC

5. Approach II: Multiple Temporal Aggregation

20/46

Page 21: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Long term forecasting

• We know that different forecasting models are better for different forecast horizons

• We also know that it helps to forecast long horizons using aggregate data

Forecasting a quarter ahead using daily data is `adventurous’ (90 steps ahead)

Forecasting a quarter ahead using quarterly data is easier (1 step ahead)

• At different data frequencies different components of the series dominate.

0 20 40 60 80 100 1200

2000

4000

6000

8000

10000

ETS(M,Ad,A) - AIC: 1273.45

Months

0 2 4 6 8 102

3

4

5

6

7

8x 10

4 ETS(A,Ad,N) - AIC: 85.92

Years

These forecasts often do not agree, which one is `correct’?

21/46

Page 22: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Any issues with current practice?

Issues with automatic modelling:

• Model selection How good is the best fit model? How reliable?

• Sampling uncertainty Identified model/parameters stable as new data appear?

• Model uncertainty Appropriate model structure and parameters?

• Transparency/Trust Practitioners do not trust systems that change substantially

0 20 40 60 80 100 1200

2000

4000

6000

8000

10000

ETS(A,Ad,M) - AIC: 1262.33

0 20 40 60 80 100 1200

2000

4000

6000

8000

10000

ETS(M,Ad,A) - AIC: 1273.45

Months

22/46

Page 23: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Any issues with current practice?

What can go wrong in parameter and model selection:

• Business time series are often short Limited data

• Estimation of parameters can fail miserably (for monthly data optimise up to 18 parameters, with often no more than 36 observations)

• Model selection can fail as well (30 models over-fitting?)

• Both optimisation and model selection are myopic Focus on data fitting in the past, rather than ‘forecastability’

• Special cases:

10 20 30 40 50 60 7080

100

120

140

160

180

200

220

Sale

s

Month

Demand Fit Forecast

True model: Additive trend, additive seasonality

Identified model:No trend, additive seasonality

Why?In-sample variance explained mostly by seasonality

23/46

Page 24: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

A different take on modelling: temporal tricks!

Traditionally we model time series at the frequency that we sampled them or take decisions.

However, a time series can be view in many different ways, adapting the notion of product

hierarchies to temporal hierarchies:

24/46

Page 25: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

How temporal aggregation changes the series

Seasonal diagrams

25/46

Page 26: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

The Idea

• Temporal aggregation strengthens and attenuates different elements of the

series:

at an aggregate level trend/cycle is easy to distinguish

at a disaggregate level high frequency elements like seasonality typically

dominate.

• Modelling a time series at a very disaggregate level (e.g. weekly) short-term

forecast. The opposite is true for aggregate levels (e.g. annual)

• Propose Temporal Hierarchies that provide a framework to optimally combine

information from various levels (irrespective of forecasting method) to:

• avoid over-reliance on a single planning level and

• merge informative views

• avoid over-reliance on a single forecasting method/model manage

uncertainty!

26/46

Page 27: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal aggregation and forecasting

• It is not new, but the question has been at which single level to model the

time series. Econometrics have investigate the question for decades

inconclusive

• Supply chain applications: ADIDA beneficial to slow and fast moving items

forecast accuracy (like everything… not always!):

• Step 1: Temporally aggregate time series to the appropriate level

• Step 2: Forecast

• Step 3: Disaggregate forecast and use

• Selection of aggregation level No theoretical grounding for general

case, but good understanding for AR(1)/MA(1) cases.

27/46

Page 28: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Multiple temporal aggregation

What if we do not select an aggregation level? use multiple

10 20 30 40100

120

140

160

180

200

Period

Dem

and

Aggregation level 1 ETS(A,N,A) ETS(A,M,A)

ETS(A,M,N) ETS(A,A,N)

Issues:• Different model• Different length• Combination

2 4 6 8 10 12 14 16100

120

140

160

180

200

PeriodD

em

and

Aggregation level 3

1 2 3 4 5 6 7100

120

140

160

180

200

Period

Dem

and

Aggregation level 7

1 1.5 2 2.5 3 3.5 4100

120

140

160

180

200

Period

Dem

and

Aggregation level 12

28/46

Page 29: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Multiple temporal aggregation

Forecast combination:

• Forecast combination is widely considered as beneficial for forecast accuracy

• Simple combination methods (average, median) considered robust, relatively accurate to more complex methods

Issue:

• If there are different model types to be combined then the resulting forecast does not fit well at any component!

10 20 30 40100

120

140

160

180

200

Period

Dem

and

10 20 30 40100

120

140

160

180

200

Period

Dem

and

29/46

Page 30: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

10 20 30 40 50 600

5000

10000

15000

5 10 15 20 25 300

5000

10000

15000

5 10 15 200

5000

10000

15000

1 2 3 4 5 60

5000

10000

15000

1 2 3 4 5 60

5000

10000

15000

1 2 3 4 50

5000

10000

15000

𝑦𝑡[1]

𝑦𝑡[2]

𝑦𝑡[3]

𝑦𝑡[10]

𝑦𝑡[11]

𝑦𝑡[12]

0 10 20 30 40 50 60 700

5000

10000

15000

Fit state space ETS

10 20 30 40 50 60-44.26

-44.24

-44.2210 20 30 40 50 60

2000

4000

6000

10 20 30 40 50 600.5

1

1.5

2

Save states

Level

Trend

Season

Fit state space ETS

0 5 10 15 20 25 30 352000

4000

6000

8000

10000

5 10 15 20 25 301

1.2

1.45 10 15 20 25 30

-96.27

-96.26

-96.255 10 15 20 25 30

2000

4000

6000

Save states

Level

Trend

Season

Aggregate

30/46

Page 31: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Transform states to additive and to original sampling frequency

Combine states (components)

Produce forecasts

31/46

Page 32: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Step 1:Aggregation

.

.

.

.

.

.

1Y

2Y

3Y

KY

2k

3k

Kk

Step 2:Forecasting

ETS

Model Selection

ETS

Model Selection

ETS

Model Selection

ETS

Model Selection

.

.

.

.

.

.

1b 1s

2b 2s

3b 3s

Kb Ks

2l

3l

Kl

1l

Step 3:Combination

+

l

b

s

1Y

1K

1K

1K

Strengthens and attenuates components

Estimation of parameters at multiple levels

Robustness on model selection and parameterisation

Multiple Aggregation Prediction Algorithm (MAPA)

32/46

Page 33: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Multiple Aggregation Prediction Algorithm (MAPA)

33/46

Page 34: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some results I

AvRelMAE on real & simulated data (Kourentzes, et al., 2017)

34/46

Page 35: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some results II

RMSE on FMCG forecasting (Barrow & Kourentzes, 2016)

35/46

Page 36: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some results III

Scaled Mean Absolute Error on SKUS with promotions(Kourentzes & Petropoulos, 2016)

36/46

Page 37: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Multiple Aggregation Prediction Algorithm (MAPA)

MAPA was developed to take advantage of temporal aggregation and hierarchies:

• MAPA provides a framework to better identify and estimate the different time series components

• Manage modelling uncertainty

• Robust against model selection and parameterisation issues

• Better forecasts

• On average outperforms ETS, one of the most widely used, robust and accurate univariate forecasting methods

• Shown to be useful for fast moving items, promotional modelling and intermittent time series forecasting.

37/46

Page 38: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies: A modelling framework

• MAPA demonstrated the strength of the approach, but it is not general:

• How to incorporate forecasts from any model/method?

• How to incorporate judgement?

• We can introduce a general framework for temporal hierarchies that borrows

many elements from cross-sectional hierarchical forecasting.

• Objective: different model families (including multivariate models) and

human judgement:

• consider different sources information

• handle uncertainty differently

• but retain modelling uncertainty themselves

➢ So merge model/method/expert forecasts get holistic view and reduce

uncertainty

38/46

Page 39: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Cross-sectional and Temporal Hierarchies

• We know how to do cross-sectional hierarchies

• Top-down, bottom-up, middle-out

• Optimal combinations

Total

UK Spain

Product A Product BProduct A Product B

We know how to do this!

… then we know how to do this as well, with some small-print!

but we have to correct for the different scales at each aggregation level, which is not that difficult due to the imposed temporal structure. For that we need to calculate the

covariance matrix between the forecast errors at different aggregation levels. There are easy and not so easy ways to do this.

39/46

Page 40: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some evidence that it actually works!

Comparison with other M3 results (symmetric Mean Absolute Percentage Error):

• Monthly dataset‒ Temporal (ETS based): 13.61%‒ ETS: 14.45% [Hyndman et al., 2002]

‒ MAPA: 13.69% [Kourentzes et al., 2014]

‒ Theta: 13.85% (best original performance) [Makridakis & Hibon, 2000]

• Quarterly dataset‒ Temporal (ETS based): 9.70%‒ ETS: 9.94% [Hyndman et al., 2002]

‒ MAPA: 9.58% [Kourentzes et al., 2014]

‒ Theta: 8.96% (best original performance) [Makridakis & Hibon, 2000]

Detailed results available, if you are interested, at the end of the presentation!

40/46

Page 41: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Application: Predicting A&E admissions

Collect weekly data for UK A&E wards.13 time series: covering different types of emergencies and different severities (measured as time to treatment)Span from week 45 2010 (7th Nov 2010) to week 24 2015 (7th June 2015)Series are at England level (not local authorities).

Accurately predict to support staffing and training decisions. Aligning the short and long term forecasts is important for consistency of planning and budgeting.

Test set: 52 weeks.Rolling origin evaluation.Forecast horizons of interest: t+1, t+4, t+52 (1 week, 1 month, 1 year).Evaluation MASE (relative to base model)As a base model auto.arima (forecast package R) is used.

41/46

Page 42: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Application: Predicting A&E admissionsTotal Emergency Admissions via A&E

Red is the prediction of the base model (ARIMA)Blue is the temporal hierarchy reconciled forecasts (based on ARIMA)

Observe how information is `borrowed’ between temporal levels. Base models for instance provide very poor weekly and annual forecasts

42/46

Page 43: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Application: Predicting A&E admissions

• Accuracy gains at all planning horizons

• Crucially, forecasts are reconciled leading to aligned plans

43/46

Page 44: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Production ready?

Multiple Aggregation Prediction Algorithm (MAPA)• Kourentzes, N.; Petropoulos, F. & Trapero, J. R. Improving forecasting by estimating

time series structural components across multiple frequencies.International Journal of Forecasting, 2014, 30, 291-302 (Details)

• Kourentzes, N.; Rostami-Tabar B. & Barrow D. K. Demand forecasting by temporal aggregation: using optimal or multiple aggregation levels? Journal of Business Research, 2017. (Modelling uncertainty view)

• Other papers extend MAPA for intermittent demand and exogenous regressors.• R code, MAPA package on CRAN: https://cran.r-project.org/package=MAPA• For intermittent demand use R package tsintermittent.

Temporal Hierarchies (THieF)• Athanasopoulos G.; Hyndman R.J.; Kourentzes, N.; Petropoulos. Forecasting with

Temporal Hierarchies. European Journal of Operational Research, 2017, 60-74.• R code, thief package on CRAN: https://cran.r-project.org/package=thief

All papers, code and examples available on my website (http://nikolaos.kourentzes.com)

44/46

Page 45: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Conclusions

• Forecast uncertainty is much bigger than the variance of the forecast errors! Uncertainty in the parameters & uncertainty in model form.

• Accounting for holistic uncertainty has implication for the construction and use of the forecasts.

• Here we looked at two potential routes forward: pAIC and Multiple Temporal Aggregation (MTA)

• pAIC is still in its infancy, but demonstrates the important of accounting model form uncertainty when choosing your forecasting model.

• MTA is implemented through MAPA (very good track record but restrictive) and temporal hierarchies (more flexible, but not universally better than MAPA).

• Side benefit of MTA: reconciled forecasts for operational/tactical/strategic planning.

45/46

Page 46: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Thank you for your attention!Questions?

Nikolaos Kourentzes

email: [email protected] | twitter: @nkourentz

blog: http://nikolaos.kourentzes.com

Published, working papers and code available at my blog!

Page 47: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Appendix

Detailed M3 results for temporal hierarchies

Page 48: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some evidence that it actually works!

BU: Bottom-Up; WLSH: Hierarchy scaling; WLSv: Variance scaling; WLSs: Structural scaling

756 series, forecast t+1 - t+8 quarters ahead

M3 quarterly dataset % error change over base % error change over base

ETS ARIMA

Page 49: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Some evidence that it actually works!

ETS ARIMA

BU: Bottom-Up; WLSH: Hierarchy scaling; WLSv: Variance scaling; WLSs: Structural scaling

1453 series, forecast t+1 - t+18 months ahead

M3 monthly dataset % error change over base % error change over base

Page 50: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Appendix

Calculation details for temporal hierarchies

Page 51: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Notation

Non-overlapping temporal aggregation to kth level:

Annual

Semi-annual

Quarterly

Observations at each aggregation level

Page 52: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Notation

Collecting the observations from the different levels in a column:

We can define a “summing” matrix S so that:

Lowest level observations

Annual

Semi-annual

Quarter

Page 53: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Example: Monthly

Aggregation levels k are selected so that we do not get fractional seasonalities

Page 54: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Forecasting

We can arrange the forecasts from each level in a similar fashion:

The reconciliation model is: Reconciliation errorshow much the

forecasts across levels do not agree

Summing matrix

Reconciled forecasts

Unknown conditional means of the future values at lowest level

The reconciliation error has zero mean and covariance matrix

Page 55: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Forecasting

If was known then we can write (GLS estimator):

But in general it is not know, so we need to estimate it.

It can be shown that is not identifiable (you need to know the reconciled forecasts, before you reconcile them), however:

Reconciliation errors

Covariance of forecast errors

So our problem becomes:

Page 56: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Forecasting

All we need now is an estimation of W

Sample covariance of

in-sample errors

In principle this is fine, but its sample size is controlled by the number of top-level (annual) observations. For example 104 observations at weekly level, results in just 2 sample points (2 years).

So the estimation of is typically weak in practice.

Page 57: Lancaster University - kourentzes.comkourentzes.com/forecasting/wp-content/uploads/2017/09/OR59... · Approach II: Multiple Temporal Aggregation 2/46. Forecasting & decision making

Temporal Hierarchies - Forecasting

We propose three ways to estimate it, with increasing simplifying assumptions.

Using as example quarterly data the approximations are:Hierarchy variance scaling

Series variance scaling

Structural scaling

Diagonal of covariance matrix less elements to

estimate

Assume within level equal variances. This is

what conventional forecasting does.

Increases sample size.

Assume proportional error variances. No need for estimates can be used when

unknown (e.g. expert forecasts).