CTL.SC1x -Supply Chain & Logistics Fundamentals

Exponential : Seasonality

MIT Center for Transportation & Logistics Annual Seasonality for Various Products Jul Jan Oct Apr Jun Feb Sep Sep Mar Dec Nov Nov Aug May May

chocolate & candy

salads

garden tools

cloth bandages

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality Agenda

• Double Exponential Smoothing Model

n Level & Seasonality • Holt-Winter Model

n Level, Trend & Seasonality • Initialization of Parameters • Practical Concerns

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 3 Double Exponential Smoothing

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 4 Analysis a

• Exponential Smoothing for Level & Seasonality Demand rate time n Double exponential smoothing SF n Introduces multiplicative seasonal term Demand rate Underlying Model: xt = aFt + et time 2 where: et ~ iid (µ=0 , σ =V[e])

Forecasting Model: ˆ ˆ ˆ The most current estimate xt,t+τ = at Ft+τ −P of the appropriate seasonal index Updating Procedure: " x % aˆ = α$ t '+ 1−α aˆ t $ ˆ ' ( )( t−1) F De-seasonalizing F = Multiplicative seasonal index # t−P & t the most recent appropriate for period t ! x $ actual observation. P = Number of time periods within the Fˆ = γ # t &+ 1−γ Fˆ seasonality t # aˆ & ( ) t−P γ = Seasonality smoothing factor " t %

Note that: P This term “de-levels” the most Fˆ P recent actual observation. ∑ i = i=1

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality Seasonality

• For multiplicative seasonality, think of the Fi as “percent of average demand” for a period i

• The sum of the Fi for all periods within a season must equal P

1.5 Fi ) i Monday 0.50 1.0 Tuesday 0.75 Wednesday 1.25 Thursday 1.00 0.5 Seasonality Factor (F Factor Seasonality Friday 1.50 Time period (t) 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 No seasonality M T W F M T W R F M T W R F Seasonality τ! ˆ ˆ ˆ xt,t+τ = at Ft+τ −P P

Suppose we are in Monday (t=105) for Thursday (t=108)? What is Ft+tau-P? • This t=105, P=5 and τ=3 and thus t+τ-P=105+3-5 = 103 ^ ^ ^ • So, x 105,108 = a 105F 103 • We modify the most recent estimate of level by the most recent relevant seasonality index

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 6 Example: Forecasting Bagels • We observe that demand is level with seasonality by day of week. It is now Friday (t=104) and we have estimated the ^ level (a 104) to be 121 bagels. The current daily seasonality factors are shown to the right and smoothing factors

alpha=0.1 and gamma=0.05. t DOW Fi ^ 100 Mon • What is your forecast for Monday (x 104,105)? 0.50 Recall that: ˆ ˆ ˆ so x^ = (121)(0.50) = 60.5 101 Tues 0.75 xt,t+τ = at Ft+τ −P 104,105 102 Wed 1.25 Suppose our actual bagel sales on Monday (t=105) was 76. • 103 Thur 1.00 What is our forecasted demand for Tuesday (t=106)? 104 Fri 1.50 Current Seasonality Factors

" x % aˆ = α$ t '+ 1−α aˆ t $ ˆ ' ( )( t−1) # Ft−P & ! x $ Fˆ = γ # t &+ 1−γ Fˆ t # ˆ & ( ) t−P " at % xˆ aˆ Fˆ =D10*E6 t,t+τ = t t+τ −P

=$C$1*(C10/E5)+(1-$C$1)*D9 =$C$2*(C10/D10)+(1-$C$2)*E5 CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 7 Normalizing Seasonality Indices

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 8 Example: Forecasting Bagels • The seasonality factors no longer sum to P!! • So what? What happens if I ignore this? • Need to update or normalize them. t DOW ^ Fi • What is the new seasonality factor F 106 ? 100 Mon 0.500 # & 101 Tues 0.750 102 Wed 1.250 NEW OLD P ˆ ˆ % ( 103 Thur 1.000 Ft = Ft % t ( 104 Fri % Fˆ OLD ( 1.500 $∑i=t−P t ' 105 Mon 0.506 106 Tues

Estimates Normalized Tues 0.750 0.749 Seasonality factors must be kept Wed 1.250 1.249 current or they will drift dramatically. Thur 1.000 0.999 This requires a lot more bookkeeping Fri 1.500 1.498 which is tricky to maintain in a Mon 0.506 0.505 Sum 5.006 5.000 spreadsheet.

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 9 Holt-Winter Model

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 10 Time Series: Level, Trend, & Seasonal • Expanding exponential Holt’s model to include trend • Commonly called the Holt-Winter Method aa • Multiplicative seasonality and additive trend Demand rate

Underlying Model: time xt = (a+tb) Ft + et

2 b where: et ~ iid (µ=0 , σ =V[e]) De-seasonalizing Demand rate the most recent time Forecasting Model: xˆ = aˆ +τbˆ Fˆ t,t+τ ( t t ) t+τ −P observation FS Where : ! x $ Old estimate t ˆ of level and aˆ = α# &+ 1−α aˆ + b Demand rate t # Fˆ & ( )( t−1 t−1) trend " t−P % time No change from Holt ˆ ˆ bt = β aˆt − aˆt 1 + 1− β bt 1 Model! ( − ) ( ) − No change from level ! x $ & seasonality model! Fˆ = γ # t &+ 1−γ Fˆ t # aˆ & ( ) t−P " t % Current observation Seasonal term from most is “de-leveled” recent similar time period. CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality Example II: Forecasting Bagels • We now observe that demand is level with additive trend and multiplicative seasonality by day of week. It is now Friday (t=104) ^ and we have estimated the level (a 104) to be 121 bagels with a ^ trend (b 104)=0.3 bagles per day. The current daily seasonality factors are shown to the right and smoothing factors are t DOW F alpha=0.1, beta=0.08, and gamma=0.05. i ^ 100 Mon 0.50 • What is your forecast for Monday (x 104,105)? 101 Tues ˆ ˆ ^ 0.75 Recall that: xˆt,t = aˆ t +τbt Ft P so x 104,105 = (121+0.3)(0.50) = 60.7 +τ ( ) +τ − 102 Wed • Suppose our actual bagel sales on Monday (t=105) was 76. What 1.25 is our forecasted demand for Tuesday (t=106)? 103 Thur 1.00 104 Fri 1.50 ! x $ aˆ = α# t &+ 1−α aˆ + bˆ t # ˆ & ( )( t−1 t−1) " Ft−P %

bˆ = β aˆ − aˆ + 1− β bˆ t ( t t−1) ( ) t−1 ! x $ Fˆ = γ # t &+ 1−γ Fˆ t # ˆ & ( ) t−P " at % ˆ ˆ xˆt,t = aˆt +τbt Ft P =$C$1*(C11/F6)+(1-$C$1)*(D10+E10) =(D11+E11)*F7 +τ ( ) +τ − =$C$2*(D11-D10)+(1-$C$2)*E10 =$C$3*(C11/D11)+(1-$C$3)*F6 CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 12 Initialization of Models

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 13 Initialization of Parameters • Points to Note

n No single best method – many good ones

n Need to partition the data (initialization, training, and testing) • Simple Exponential Smoothing Model ^ n Estimate initial level parameter (a 0) n Use average demand for first several periods • Holt Model ^ ^ n Estimate initial level (a 0) and trend (b 0) parameters (a & b) n Find best fit linear equation to data in initial data set

n Use ordinary regression of demand for several periods

w Dependent variable = demand in each time period = xt

w Independent variable = slope = β1

w Regression equation: xt = β0 + β1t n Note: this gives equal weight to each observation in the initialization data sample

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 14 Initialization of Parameters • Seasonality Models

n These are much more complicated

n Several different methods used in practice

n You need lots of data – >2 seasons worth but prefer ≥4 seasons • Double Exponential Smoothing Model ^ ^ n Estimate initial level parameter (a 0) & seasonality indices (F i) n Find average demand for each common season period

n Find average demand for all periods

n Set initial seasonality indices to ratio of each season to all periods

Average Initial 200 Daily Seasonality 180 160 Day Demand Index 140 Mon 60 0.50 120 Tues 90 0.75 100 80 Wed 151 1.25 60

Daily Bagel Demand Demand Bagel Daily Thur 121 1.00 40 80 85 90 95 100 Fri 181 1.50 Time Period (t=80 is Monday) All Days 121 CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 15 Initialization – Holt-Winter 1. Estimate initial level for each season MA5 n Find P-Moving Avg centered in each season Actual Center Initial Fi Week t DOW Demand point Estimate n Take ratio of actual to initial Fi estimate 1 80 M 62 2. Find initial season indices 81 T 91 n Average F for common periods 82 W 163 128.3 1.273 i 83 R 129 129.4 1.000 300 84 F 196 132.0 1.483 Actual Demand MA5 Centerpoint 2 85 M 68 137.9 0.492 250 86 T 104 141.3 0.735

200 87 W 193 147.3 1.307 88 R 147 149.8 0.979 150 89 F 226 152.5 1.481

100 3 90 M 80 154.3 0.518 Daily Bagel Demand Demand Bagel Daily 91 T 118 160.0 0.736 50 92 W 201 169.7 1.186 80 85 90 95 100 Time Period (t=80 is Monday) 93 R 175 172.2 1.018 94 F 274 176.9 1.551 DOW Average of F Estimates Normalized F s i i 4 95 M 92 185.9 0.495 M 0.501 0.506 96 T 142 188.4 0.752 T 0.741 0.748 97 W 246 191.5 1.286 W 1.195 1.195 98 R 187 R 0.998 0.998 99 F 290 F 1.516 1.516 Sum 4.952 5.000 CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 16 Initialization – Holt-Winter 3. Estimate initial level and trend values n De-season each observation by dividing by its estimated Seasonality Index ^ n Use these values to estimate a 0 ^ and b 0 using OLS regression

300 Actual Demand Level & Trend Linear (Level & Trend)

250 y = 4.1926x - 216.9 R² = 0.92903 200

150

100

50 80 85 90 95 100

So, for t=100 (start of our modeling) ^ a 0=(4.1926)(100)-216.9 = 202.36≈202.4 ^ b 0 = 4.1926 ≈ 4.2 ^ F i={0.506, 0.748, 1.195, 0.998, 1.516} for {M,T,W,R,F} CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 17 Final Comments on Exponential Smoothing

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 18 Comments on Time Series Models

• Three phases of work on three different data sets n Initialize: Estimate level, trend, and/or seasonality factors

n Train: Determine the smoothing parameters to use n Test: Evaluate the quality (accuracy & bias) of forecasts • Selecting data for use in model formulation n Needs to be appropriately long but still relevant

n Needs to be cleaned of all non-repeating events • Picking appropriate smoothing factors n Level (α) w Stationary: ranges from 0.01 to 0.30 (0.1 reasonable) w Trend/Season: ranges from 0.02 to 0.51 (0.19 reasonable) n Trend (β) w Ranges from 0.005 to 0.176 (0.053 reasonable) n Seasonality (γ) w Ranges from 0.05 to 0.50 (0.10 reasonable)

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 19 Comments on Time Series Models

• Most of the work is bookkeeping n Initialization procedures are somewhat arbitrary n Adding seasonality greatly complicates calculations

• Measuring Bias in Forecasts n Track the cumulative sum of Forecast Errors n Normalize by square of errors n Should fluctuate around 0 Ct = Ct−1 + et N Ct = Ct MSEt

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 20 Comments on Time Series Models

• Variety of More Sophisticated Models

n Seasonality: None, Additive, or Multiplicative

n Trend: None, Additive, or Multiplicative

n Trend Damping: None or Present

n Box-Jenkins or Autoregressive Integrated (ARIMA)

Seasonality Component None Additive Multiplicative

None Simple Double Additive Holt Holt-Winter Additive Damped Holt Damped

Trend Multiplicative

Component Multiplicative Damped

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 21 CTL.SC1x -Supply Chain & Logistics Fundamentals Questions, Comments, Suggestions? Use the Discussion!

“Ginger Belle” Photo courtesy Yankee Golden Retriever Rescue (www.ygrr.org) MIT Center for Transportation & Logistics [email protected] Image Credits

• slide 2 –

n "Valentines Day Chocolates from 2005" by John Hritz from Ann Arbor, MI, USA - Flickr. Licensed under Creative Commons Attribution 2.0 via Wikimedia Commons - http:// commons.wikimedia.org/wiki/ File:Valentines_Day_Chocolates_from_2005.jpg#mediaviewer/ File:Valentines_Day_Chocolates_from_2005.jpg

n "Johns Inc Salad Bar Buffet" by Tudokin - Own work. Licensed under Creative Commons Attribution-Share Alike 3.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Johns_Inc_Salad_Bar_Buffet.jpg#mediaviewer/ File:Johns_Inc_Salad_Bar_Buffet.jpg

n By Das Ant (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0) or GFDL (http://www.gnu.org/copyleft/fdl.html)], via Wikimedia Commons. http://commons.wikimedia.org/wiki/File%3AGartengeraete.jpg

n "Bandaż" by Original uploader was Reytan at pl.wikipedia - Transferred from pl.wikipedia; transferred to Commons by User:Pjahr using CommonsHelper.. Licensed under Public domain via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Banda %C5%BC.jpg#mediaviewer/File:Banda%C5%BC.jpg

CTL.SC1x - Supply Chain and Logistics Fundamentals Lesson: Exponential Smoothing with Seasonality 23