You are on page 1of 48

Statistical Forecasting Basics –

Demand Planning

May 28, 2018


Prashant Gopalan
SAP APO Demand Planning

Statistical Toolbox

 Univariate Forecasting
– Moving Average
– Simple Linear Regression
– Exponential Smoothing
– Holt-Winters
– Croston’s Model (for sporadic demand)
 Causal Analysis
– Multiple Linear Regression
 Composite Forecasting
– Weighted Averaging of Multiple Models

2 5/28/2018
SAP APO Demand Planning

Univariate Profile in APO


Entries
Historical input
Version,
Version and key figure
Key figure

Model parameters
Forecast strategy,
Strategy, seasonal length,
Periods per season,
smoothing parameters
Parameters: a, b, g, s

Control parameters
Without Leading Zeros,
Outlier correction, adjustment Outliers,
of corrected history,
workdays correction Days in Period

MAD, total error,


Forecast errors MAPE, RMSE,
MSE, MPE
3 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value /


Seasonal Index
 Length of season / Model Initialization / Ex-post
Forecast
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Example of forecast calculation
 Forecast Errors

4 5/28/2018
SAP APO Demand Planning

Actual / Basic / Trend Value / Seasonal Index

5 5/28/2018
SAP APO Demand Planning

How APO Help in forecasting!!

History
500

400
Units

300

200

100

0
Y-4 Y-3 Y-2 Y-1 Y+1
Time Now

6 5/28/2018
SAP APO Demand Planning

Determine Base Level & Trend

History Trend
500

400
Units

300 Level = 170

200

100

0
Y-4 Y-3 Y-2 Y-1 Y+1
Now

7 5/28/2018
SAP APO Demand Planning

Model Seasonality

History Model Trend


500

400
Units

300

200

100

0
Y-4 Y-3 Y-2 Y-1 Y+1
Now

8 5/28/2018
SAP APO Demand Planning

Forecast Future Sales / Demand

History Forecast Model Trend


500

400
Units

300

200

100

0
Y-4 Y-3 Y-2 Y-1 Y+1
Time Now

9 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Example of forecast calculation
 Forecast Errors

10 5/28/2018
SAP APO Demand Planning

Length of Season / Model Initialization

11 5/28/2018
SAP APO Demand Planning

Ex post forecast

12 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Example of forecast calculation
 Forecast Errors

13 5/28/2018
SAP APO Demand Planning

Univariate Model Parameters

Seasonal value (g)


Trend value (b)
Basic value (a)

Past Future
14 5/28/2018
SAP APO Demand Planning

Data smoothing – Significance of a

 Single exponential smoothing (SES) – Mathematical Calculation is


based on following formula
– Ft+1 = a X t + (1-a) Ft
– Ft+1 = a X t + a(1-a) X(t -1) + a. a.(1- a) X(t-2) + …..

 Based on above formula, an alpha value of 0.5 weights historical


values as follows:
– 1st historical value: 50%, 2nd historical value: 25%
– 3rd historical value: 12.5%, 4th historical value: 6.25%......

 Hence, as you increase value of alpha from 0.1 to 0.9,


– weights attached to the most recent observation increases
– weights to past observation decreases exponentially

 The most common values for alpha lie, between 0.1 and 0.5.

15 5/28/2018
SAP APO Demand Planning

Example – Constant using alpha 01 Vs 0.5

16 5/28/2018
SAP APO Demand Planning

Weighting of historical periods

17 5/28/2018
SAP APO Demand Planning

Constant & Trend using alpha & beta 01. Vs 0.5

18 5/28/2018
SAP APO Demand Planning

Seasonal Method – Weighting factor Gamma

 Recommendation : Gamma should be between 0.5 and 0.7


(for 2 or 3 yrs of history)

19 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Example of forecast calculation
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Forecast Errors

20 5/28/2018
SAP APO Demand Planning

Outliers

5/28/2018
SAP APO Demand Planning

Parameters for Outlier Correction

 Tolerance lane calculated based on sigma factor & ex-post forecast

 Smaller the sigma factor, Less the tolerance, greater the control

 Historical value outside upper & lower limit of tolerance lane is


corrected

 SAP recommended value for sigma factor should be between 0.6 –


2.0

22 5/28/2018
SAP APO Demand Planning

Outlier Calculation logic


 Outliers are calculated in following
steps, it is assumed that data has
trend. Trend model is used for
explanation.
– Step 1 –
• Based on history, Forecast
model is initialized
• Basic value / Trend Value
calculated based on Alpha /
Beta value
• Ex-post forecast calculated
based on Basic / Trend value
• MAD calculated based on Ex-
post forecast
• Basic / Trend / Ex-post forecast
/ MAD calculated for history
horizon
– Step 2 –
• Tolerance lane values are
calculated based on Sigma Note :Outlier correction can be done based on Median as
factor, MAD & Ex-post forecast well in SAP APO version 4.1 and up

values
23 5/28/2018
SAP APO Demand Planning

Outlier Calculation logic

 Outliers are calculated in following


steps
– Step 3 –
• System compares values of
Tolerance lane (+/-) with history
• If the historical value of some
period is outside tolerance lane
system stores Ex-post value as
it’s corrected history for that
period.
– Step 4 –
• Corrected history is used to re-
calculate Basic / Trend / Ex-
post forecast values
• Based on these new
parameters statistical forecast
is generated in future

Note :Outlier correction can be done based on Median as


well in SAP APO version 4.1 and up

24 5/28/2018
SAP APO Demand Planning

Outlier Correction - Effect of Sigma value

 Sigma Value 1.25


– Historical value Period 7 are outside tolerance lane
– Period 7 history modified based on ex-post forecast for that period
– Forecast generated based on corrected history

25 5/28/2018
SAP APO Demand Planning

Outlier Correction - Effect of Sigma value

 Sigma Value 0.6


– Historical values for Period 6 & Period 7 are outside tolerance lane
– Period 6 & Period 7 history modified based on ex-post forecast for that
period
– Forecast generated based on corrected history
– Smaller the sigma factor, Smaller the tolerance, Greater control

26 5/28/2018
SAP APO Demand Planning

Outlier Correction - Effect of Sigma value

 Sigma Value 2.00


– None of the Historical value are outside tolerance lane
– Corrected history is the same as history
– Forecast generated based on corrected history
– Higher the sigma factor, Bigger the tolerance lane, Lesser control

27 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Example of forecast calculation
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Forecast Errors

28 5/28/2018
SAP APO Demand Planning

Forecasting Models - Explanation

 Moving Average –
– Assumption : Data varies 12
Series 3 point MA 5 point MA

around a constant value and


shows no seasonality and
trend
11

Volume
 Weighted Moving Average –
– Assumption : Data varies 10
around a constant value and
shows no seasonality and
trend
9
Jan Apr Jul Oct Jan Apr Jul Oct Jan Apr Jul Oct
– Every historical value is
History Future
weighted with a factor

29 5/28/2018
SAP APO Demand Planning

Forecasting Models - Explanation

 Trend Method – Exponential


Smoothing
3
–Assumption : Data varies around a
Series 5 Point MA Exponential Smoothing
constant value plus a linear trend,
but shows no seasonality
2.5
–Alpha value also controls the
variability of the trend

Volume
2

 Seasonal Method – Exponential


Smoothing 1.5
–Assumption : Data varies around a
constant value plus a seasonal
pattern, but shows no trend 1
Jan Apr Jul Oct Jan Apr Jul Oct Jan Apr Jul Oct Jan Apr Jul Oct
–Alpha value also controls the
History Future
variability of the seasonality

30 5/28/2018
SAP APO Demand Planning

Forecasting Models - Explanation


 Seasonal – Trend Method – Exponential Smoothing
– Assumption : Data varies around a constant value plus a trend & seasonal
pattern

 Seasonal Linear Regression –


– Assumption : Data varies around a constant value plus a small trend &
seasonal pattern
– Forecast is controlled by seasonal values & periods per season

 Manual Forecast –
– Assumption – Not interested in system to propose basic & trend values
– Define Basic, trend value yourself.

 Croston Method
– Assumption : Demand Occurs every X period

31 5/28/2018
SAP APO Demand Planning

Forecasting Models - Explanation

 Auto Model I
– Assumption : Data has visible trend & seasonal pattern, 1st order
exponential smoothing required
– System checks intermittent pattern in historical data – If data is not there
for more than 66% of total period, Propose Croston Model.
– System checks seasonal effect by determining Auto co-relation
– System checks trend by trend significance test
– If any of these checks are not valid, results in no forecast

 Auto Model II
– Assumption : Data has visible trend & seasonal pattern, 1st order / 2nd
order exponential smoothing required
– System checks intermittent pattern in historical data – If data is not there
for more than 66% of total period, Propose Croston Model.
– System checks white noise, if it finds, Propose Constant model.
– Checks for Constant / Trend / Seasonal / Seasonal trend / Seasonal
Linear Regression starting from alpha / beta / gamma equal to 0.1

32 5/28/2018
SAP APO Demand Planning

Trend Method – Linear Regression

 Assumption : Data varies around a constant value plus a linear trend,


but shows no seasonality
– A straight line is calculated minimizing the sum of quadratic deviations to
all historical data inputs (method 94)
Note – This method is heavily influenced by outliers.

33 5/28/2018
SAP APO Demand Planning

Seasonal Method – Seasonal Linear Regression

 Assumption : Data varies around a


constant value plus a moderate trend
& seasonal pattern
– Step 1 –
• per year avg value is
calculated,
– Step 2 –
• Per year the seasonality is
calculated as ratio between the
historical data and yearly
average,
• For the future the average of
yearly seasonalities i.e
seasonal index is calculated,
• Seasonality can be smoothed
by averaging several
consecutive periods. The
number of periods is given by
the parameter PERSMO

34 5/28/2018
SAP APO Demand Planning

Seasonal Method – Seasonal Linear Regression

– Step 3 –
• Every historical value is divided
by the corresponding average
seasonal index
• This results in historical data
corrected by seasonality
– Step 4 –
• Linear regression is carried out
for the corrected historical data
• The linear regression forecast is
multiplied by the seasonal index

 Note : SLR tends to calculate lower


forecast in the first future periods for
data with strong trends, It is more robust
and needs no parameters.

35 5/28/2018
SAP APO Demand Planning

Croston Method -

 Assumption – Demand occurs every x period with similar quantities


 Croston Method estimates –
– The average number of periods between two historical demands and
– The average demand quantity

36 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Example of Forecast calculation
 Forecast Errors

37 5/28/2018
SAP APO Demand Planning

Trend Model – Initialization & Ex-Post forecast

38 5/28/2018
SAP APO Demand Planning

Trend Model – Calculate new basic & Trend

39 5/28/2018
SAP APO Demand Planning

Trend Model – Calculation Repeated

40 5/28/2018
SAP APO Demand Planning

Trend Model – Calculation Repeated

41 5/28/2018
SAP APO Demand Planning

Seasonal Method – Seasonal trend

42 5/28/2018
SAP APO Demand Planning

Elements Of Univariate Forecast in APO

 Actual Value / Basic Value / Trend Value / Seasonal


Index
 Length of season / Model Initialization / Ex-post
Forecast
 Forecast Parameters
 Outlier Correction
 Univariate Forecast Model explanation
 Example of forecast calculation
 Forecast Errors

43 5/28/2018
SAP APO Demand Planning

Forecast Errors

 Mean Absolute Deviation –


– Difference between the fitted forecast and the actual demand
– “Absolute” refers to an actual measurement of units rather than a
percentage or profile

 Error Total
– Used primarily as a measure of systematic error
– Bias: Measure of error that can create large cumulative error

 Mean Percentage Error (MPE)


– Moving average of error
– Error = Difference between the fitted forecast and the actual demand

44 5/28/2018
SAP APO Demand Planning

Forecast Errors (Cont..)

 Mean Absolute Percentage Error (MAPE)


– Moving average of Percent error
• Percent error: Error stated as percent of Actual or as percent of
Forecast
• Absolute percent error: Percent error stated as a positive number
– Use arithmetic average of user defined weights

 Mean square error (MSE)


– Moving average of Squared error
• Squared error: Square of (Actual minus Forecast)
• Moving average: Method to average recent history to forecast
forward for short period
– Use arithmetic average of user defined weights

 Square root of the mean squared error (RMSE)


– Square root of Mean square error

45 5/28/2018
SAP APO Demand Planning

Forecast Errors (Cont..)

 From all the available methods for forecast errors most common is:
– Mean Absolute Percent Error (MAPE)

 Reason -
– It’s easy to Understand
– It’s relatively easy to calculate and correlate with the business results
– All errors weighted equally

46 5/28/2018
SAP APO Demand Planning

Forecast Bias
 Definition-
– Variance of historical sales volume over the forecasted sales volume as a
positive or negative percentage.
– Positive is oversell or under-forecasted &
– Negative is undersell or over-forecasting
 Develop Custom Reports for generating forecast bias, This is a good method
to keep track of forecast Vs. current sales.
– In APO there is no default calculation for forecast bias.

47 5/28/2018
SAP APO Demand Planning

Questions and Answers

???

Your Opportunity to ask Questions!

48 5/28/2018

You might also like