Demand Forecasting I Time Series Analysis Chris Caplice ESD.260/15.770/1.260 Logistics Systems Sept 2006 Agenda “Predictions are usually difficult – especially for the future” Yogi Berra Problem and Background Four Fundamental Approaches Time Series Methods MIT Center for Transportation & Logistics – ESD.260 2 © Chris Caplice, MIT Demand Processes Demand Forecasting Predict what will happen in the future Typically involves statistical, causal or other model Conducted on a routine basis (monthly, weekly, etc.) Demand Planning Develop plans for creating or affecting future demand Results in marketing & sales plans – builds unconstrained forecast Conducted on a routine basis (monthly, quarterly, etc.) Demand Management Make decisions in order to balance supply and demand within the forecasting/planning cycle Includes forecasting and planning processes Conducted on an on-going basis as supply and demand changes Includes yield management, real-time demand shifting, forecast consumption tracking, etc. MIT Center for Transportation & Logistics – ESD.260 3 © Chris Caplice, MIT Four Fundamental Approaches Subjective Objective Judgmental Time Series Sales force surveys Delphi techniques Jury of experts Experimental “Black Box” Approach Uses past to predict the future Causal / Relational Customer surveys Focus group sessions Test Marketing Simulation Econometric Models Leading Indicators Input-Output Models Often times, you will need to use a combination of approaches MIT Center for Transportation & Logistics – ESD.260 4 © Chris Caplice, MIT Cost of Forecasting vs Inaccuracy Å Good Region Æ Å Overly Naïve Models Æ Å Excessive Causal Models Æ Cost Total Cost Cost of Errors In Forecast Cost of Forecasting Forecast Accuracy MIT Center for Transportation & Logistics – ESD.260 5 © Chris Caplice, MIT Time Series The typical problem: Generate the large number of short-term, SKU level, locally disaggregated demand forecasts required for production, logistics, and sales to operate successfully. Predominant use is for: Forecasting product demand of . . . Mature products over a . . . Short time horizon (weeks, months, quarters, year) . . . Using models to assist in the forecast where . . . Demand of items is independent Special situations are treated differently New product introduction Old product retirement Short life-cycle products Erratic and sparse demand MIT Center for Transportation & Logistics – ESD.260 6 © Chris Caplice, MIT Time Series Level (a) Value where demand hovers around Trend (b) Persistent movement in one direction Typically linear but can be exponential, quadratic, etc. Seasonal Variations (F) Movement that is periodic to the calendar Hourly, daily, weekly, monthly, quarterly, etc. Cyclical Movements (C) a time Demand rate Basic Components Demand rate Method of using past occurrences to model the future Assumes some regular & recurring basis over time b Periodic movement not tied to calendar Random Fluctuations (e or ε) Irregular and unpredictable variations, noise Combine components to model demand in period t Multiplicative: xt = (b)(F)(C)(e) Additive: xt = a + b(t) + Ft + Ct + et Mixed: Combination xt = a + b(Ft)t + et MIT Center for Transportation & Logistics – ESD.260 7 Demand rate time S time © Chris Caplice, MIT Time Series Simple Procedure 1. Select an appropriate underlying model of the demand pattern over time 2. Estimate and calibrate values for the model parameters 3. Forecast future demand with the models and parameters selected 4. Review model performance and adjust parameters and model accordingly MIT Center for Transportation & Logistics – ESD.260 8 © Chris Caplice, MIT Time Series: Example 116 115 114 113 112 111 110 109 108 140 120 Volume 10 91 82 73 64 55 46 37 28 19 10 100 1 Demand What is the forecast for period t+τ made at the end of period t, ̂xt,t+τ? 80 60 40 Week 20 0 0 40 60 80 100 120 Week So, what can I say? MIT Center for Transportation & Logistics – ESD.260 20 9 © Chris Caplice, MIT Time Series How important is the history? Two extreme assumptions . . . . Naïve Forecast Cumulative Forecast All history matters equally Pure stationary demand Underlying Model: x t Most recent dictates next Random Walk, Last is Next Underlying Model: = a + e x t where: t = xt-1 + e t where: e t ~ iid (μ=0 , σ2=V[e]) Forecasting Model: x t ,t +1 = ∑ e t ~ iid (μ=0 , σ2=V[e]) Forecasting Model: t x t ,t +1 = xt x i =1 i t MIT Center for Transportation & Logistics – ESD.260 10 © Chris Caplice, MIT Time Series Moving Average Only include the last M observations Compromise between cumulative and naïve Cumulative model (M=n) Naïve model (M=1) Assumes that some step (S) occurred Underlying Model: x t = a + e So, some questions t where: e t ~ iid (μ=0 , σ2=V[e]) Forecasting Model: x t ,t +1 = ∑ t i =t +1− M How do we find M? What trade-offs are involved? How responsive are the three models? xi M MIT Center for Transportation & Logistics – ESD.260 11 © Chris Caplice, MIT Moving Average Forecasts 116.00 115.00 114.00 113.00 112.00 111.00 110.00 109.00 ActDemand MA10 MIT Center for Transportation & Logistics – ESD.260 Naïve MA20 12 91 10 0 82 73 64 55 46 37 28 19 1 10 108.00 MA3 Cumulative © Chris Caplice, MIT Time Series: Exponential Smoothing Why should past observations all be weighted the same? Value of observation degrades over time Introduce smoothing constant (α) Underlying Model: x t = a + e t where: e t ~ iid (μ=0 , σ2=V[e]) Forecasting Model: Recall that et = xt - ̂xt-1,t ̂xt,t+1 = ̂xt-1,t + αet (0<α<1) or ̂xt,t+1=αxt + (1-α)̂xt-1,t MIT Center for Transportation & Logistics – ESD.260 13 © Chris Caplice, MIT Time Series: Exponential Smoothing ̂xt,t+1 = αxt + (1-α) ̂xt-1,t but recalling that ̂xt-1,t = αxt-1 + (1-α) ̂xt-2,t-1 ̂xt,t+1 = αxt + (1-α)(αxt-1 + (1-α) ̂xt-2,t-1) ̂xt,t+1 = αxt + α(1-α)xt-1 + (1-α)2 ̂xt-2,t-1 ̂xt,t+1 = αxt + α(1-α)xt-1 + α(1-α)2xt-2 + (1-α)3 ̂xt-3,t-2 ̂xt,t+1 = α(1-α)0xt + α(1-α)1xt-1 + α(1-α)2xt-2 + α(1-α)3xt-3... MIT Center for Transportation & Logistics – ESD.260 14 © Chris Caplice, MIT Time Series: Exponential Smoothing Pattern of Decline in Weight Effective Weight 1 0.8 alpha=.1 alpha=.5 alpha=.9 0.6 0.4 0.2 0 0 1 2 3 4 5 Age of Data Point MIT Center for Transportation & Logistics – ESD.260 15 © Chris Caplice, MIT Time Series: Non-Stationary Models MA with Trend Data 30 Demand 25 20 15 10 5 0 1 2 3 4 5 6 7 8 9 10 11 12 Period Demand MA(3) MA(6) Note that MA and standard Exp Smoothing will just lag a trend They only look at history to find the stationary level Need to capture the ‘trend’ or ‘seasonality’ factors MIT Center for Transportation & Logistics – ESD.260 16 © Chris Caplice, MIT Time Series: Level & Trended Data Forecasting Model: ̂xt,t+τ = ̂at + τ ̂bt Where: ̂at = αxt + (1-α)( ̂at-1 + ̂bt-1) a time Demand rate Underlying Model: x t = a + bt + e t where: e t ~ iid (μ=0 , σ2=V[e]) Demand rate Similar to exponential smoothing Holt’s Method - smoothing constants for level (a) and trend (b) terms b time ̂bt = β( ̂at - ̂at-1) + (1- β) ̂bt-1 MIT Center for Transportation & Logistics – ESD.260 17 © Chris Caplice, MIT Time Series: Level & Trended Data This is a linear weighted combination of level at A and B Forecast follows on this line Forecast at t+1 Demand or Forecast aˆt +1 xt aˆt = α HW xt + (1 − α HW )(aˆt −1 + bˆt −1 ) A B A bˆt = β HW (aˆt − aˆt −1 ) + (1 − β HW )bˆt −1 ât B aˆt −1 (aˆt − aˆt −1 ) C bˆt −1 D C D (aˆt −1 + bˆt −1 ) 0 t-1 Source: Atul Agarwal MLOG’05 t t+1 Time MIT Center for Transportation & Logistics – ESD.260 This is a linear weighted combination of slopes at C and D Objective is to forecast t+1 & beyond 18 © Chris Caplice, MIT Time Series: Level & Seasonal Data Underlying Model: x t = aFt + e t where: e t ~ iid (μ=0 , σ2=V[e]) Demand rate Multiplicative model using exponential smoothing Introduces seasonal term, F, that covers P periods. a Forecasting Model: ̂xt,t+τ = ̂at ̂Ft+τ-P Where : ̂at = α(xt/ ̂Ft-P) + (1- α) ̂at-1 ̂Ft = γ(xt/ a ̂ t) + (1- γ) ̂Ft-P Demand rate time S time An Example where P=4, t=12, τ=1: ̂x12,13 = ̂a12 ̂F9 ̂a12 = α(x12/ ̂F8) + (1- α) ̂a12 ̂F12 = γ (x12/ ̂a12) + (1- γ) ̂F8 MIT Center for Transportation & Logistics – ESD.260 19 © Chris Caplice, MIT Time Series: Level, Seasonal, & Trended Data Where : ̂at = α(xt/ ̂Ft-P) + (1- α)( ̂at-1+ ̂bt-1) ̂bt = β( ̂at - ̂at-1) + (1- β) ̂bt-1 ̂Ft = γ(xt/ ̂at) + (1- γ) ̂Ft-P a time Demand rate Forecasting Model: ̂xt,t+τ =( ̂at +τ ̂bt) ̂Ft+τ-P b time Demand rate Underlying Model: x t = (a+bt) Ft + e t where: e t ~ iid (μ=0 , σ2=V[e]) Demand rate Expand exponential model to include seasonality Winter’s Method – Similar to Holt’s Method with added term Seasonality is multiplicative S time MIT Center for Transportation & Logistics – ESD.260 20 © Chris Caplice, MIT Comments on Time Series Models Most of the work is bookkeeping Initialization procedures can be arbitrary Adding seasonality greatly complicates calculations Most of the value comes from sharing with users Provide insights into explaining abnormalities Assist in initial formulations and models Picking appropriate smoothing factors Level (α) Stationary: ranges from 0.01 to 0.30 (0.1 reasonable) Trend/Season: ranges from 0.02 to 0.51 (0.19 reasonable) Trend (β) Ranges from 0.005 to 0.176 (0.053 reasonable) Seasonality (γ) Ranges from 0.05 to 0.50 (0.10 reasonable) MIT Center for Transportation & Logistics – ESD.260 21 © Chris Caplice, MIT Questions, Comments, Suggestions?