# Forecasting Workshop

11/17/2003

Background
What it is: A detailed presentation focusing on the Mathematical methods of prediction that are standard in APO-Demand Planning. It is based on the Functionality found in release 3.1.

Anyone interested in upgrading it to 4.0 ?

© SAP AG 2002, Title of Presentation, Speaker Name / 2

Overview of the Forecasting Workshop

1

Overview of Forecasting in APO

2

History

3 4

Univariate Forecast Basics Univariate Models in APO

5 Forecast Error Analysis 6 Master Forecast Profile Setup 7 Forecast Execution

© SAP AG 2002, Title of Presentation, Speaker Name / 3

Speaker Name / 4 .What we will talk about today 3 4 Univariate Forecast Basics Univariate Models in APO 5 Forecast Error Analysis © SAP AG 2002. Title of Presentation.

Speaker Name / 5 . Title of Presentation.3 4 Univariate Forecast Basics Univariate Models in APO 5 Forecast Error Analysis © SAP AG 2002.

Elements of the Univariate Forecast Actual Value Basic Value Trend Value Seasonal Index Length of Season Initialization Ex-post Forecast Forecast Parameters Exceptions are models 13. 70. 94 © SAP AG 2002. Title of Presentation. 35. Speaker Name / 6 . 14. 80.

Title of Presentation.Actual Value Historical values used as the basis of the forecast Data Values Past Horizon © SAP AG 2002. Speaker Name / 7 .

Basic Value

Basic Value - Controls Vertical Placement

Data Values

2000

2 1

1000

Forecast Horizon

© SAP AG 2002, Title of Presentation, Speaker Name / 8

Trend Value

Trend - Slope of line

2
Data Values .75

-.75

1
Forecast Horizon

© SAP AG 2002, Title of Presentation, Speaker Name / 9

Seasonal Index

Seasonal index - Divergence from Basic Value

Data Values

2.50

1.00 .25

Forecast Horizon

© SAP AG 2002, Title of Presentation, Speaker Name / 10

Speaker Name / 11 .Length of Season Number of Periods in the Season Typically = one year Data Values Season © SAP AG 2002. Title of Presentation.

and the Mean Absolute Deviation are initialized. Speaker Name / 12 . Title of Presentation. Seasonal indices. Trend value. © SAP AG 2002.Initialization Basic value.

Ex-post forecast length is the history horizon less the initialization horizon Future © SAP AG 2002. Title of Presentation.Initialization length is dependent on the forecast model . Speaker Name / 13 . Initialization Data Values Ex-post Forecast Forecast History Values Forecast Values History .Ex-post Forecast An Ex post Forecast is a forecast run in the past for comparison exagainst historical values. The ex-post forecast is used to measure model fit.

Ex-post Forecast ExThe following Models do not generate an Ex-post forecast: 13 14 60 70 Moving average Weighted moving average Historical data adopted Manual forecast © SAP AG 2002. Speaker Name / 14 . Title of Presentation.

trend(t).General Calculation Basic(t). trend(t). seasonal(t) = Function(actual(t). basic(t-1). trend(t-1). Title of Presentation. seasonal(t)) © SAP AG 2002. seasonal(t-1s)) Forecast = Function(basic(t). Speaker Name / 15 .

Basic Value T . Title of Presentation. Speaker Name / 16 .Trend EX Ex-post F Forecast 2 95 6 110 7 110 4 Trend Initialization Basic Value Initialization Ex-Post Forecast Ex(t +i) = G(t) + i * T(t) Where i = 1 © SAP AG 2002.0 Forecast Horizon 1 2 3 Period 1 80 History G .Trend Model Example – Initialization & Ex-Post History Horizon 3 4 5 100 115 125 102 10.

3 [ 113 – 102 ] + (.7) [ 102 + 10.0 112 123 6 110 7 110 Forecast Horizon 1 2 3 4 Basic Value G(t) = αV(t) + (1. Title of Presentation.3 10.Trend EX Ex-post F Forecast 2 95 History Horizon 3 4 5 100 115 125 113 102 10.0 Ex-Post Forecast Ex(t +i) = G(t) + i * T(t) Where i = 1 123 = 113 + 10. Speaker Name / 17 .0 ] Trend Value T(t) = β [ G(t) .α) [ G(t-1) + T(t-1) ] 113 = .3 = .7) 10.3 © SAP AG 2002.3 (115) + (.G(t-1) ] + (1-β)T(t-1) β 10.Basic Value T .Trend Model Example – Calculate New Basic and Trend Period 1 80 History G .

0 112 123 6 110 127 8.1 135 Forecast Horizon 1 2 3 4 134 Ex-Post Forecast Ex(t +i) = G(t) + i * T(t) Where i = 1 Forecast P(t+i) = G(t) + i * T(t) Basic Value Trend Value G(t) = αV(t) + (1.Trend EX Ex-post F Forecast 2 95 History Horizon 3 4 5 100 115 125 113 124 102 10.α) [ G(t-1) + T(t-1) ] T(t) = β [ G(t) .3 10.5 10. Title of Presentation.Basic Value T .3 134 7 110 128 6.Trend Model Example – Calculation Repeated Period 1 80 History G .G(t-1) ] + (1-β)T(t-1) β © SAP AG 2002. Speaker Name / 18 .

α) [ G(t-1) + T(t-1) ] T(t) = β [ G(t) .G(t-1) ] + (1-β)T(t-1) β © SAP AG 2002.3 134 7 110 128 6.Trend EX Ex-post F Forecast 2 95 History Horizon 3 4 5 100 115 125 113 124 102 10.1 134 128 6. Title of Presentation.3 10.Basic Value T .5 10.1 135 Forecast Horizon 1 2 3 128 6.0 112 123 6 110 127 8.Trend Model Example – Calculation Repeated Period 1 80 History G .1 140 128 6. Speaker Name / 19 .1 146 152 4 Ex-Post Forecast Ex(t +i) = G(t) + i * T(t) Where i = 1 1 2 Forecast P(t+i) = G(t) + i * T(t) Basic Value Trend Value G(t) = αV(t) + (1.

Alpha is used in the basic value calculation Beta is used in trend value calculation Gamma is used in the Seasonal index calculation The value for the parameters range from 0 to 1. Alpha. Title of Presentation. Speaker Name / 20 . and Gamma.Model parameters The model parameters. © SAP AG 2002. A higher value will place more emphasis on recent history. control the weighting of each historical values. Beta. The parameters also control how reactive the forecast is to changes in historical patterns.

3 4 5 Univariate Forecast Basics Univariate Models in APO Forecast Error Analysis © SAP AG 2002. Title of Presentation. Speaker Name / 21 .

Title of Presentation. Speaker Name / 22 .Univariate Forecasting Models Constant Models Moving Average Models Trend Models Seasonal Models Seasonal Trend Models Automatic Model Selection I and II Sporadic Demand Historical Data Model Linear Regression User Exit © SAP AG 2002.

Title of Presentation. Speaker Name / 23 .Constant Models 3 models within the constant model group: Constant Model (10) 1st Order Exponential Smoothing (11) Same Formula ! 10 = 11 Constant Model with automatic Alpha adaptation (12) Constant Models follow the pattern: © SAP AG 2002.

Alpha parameter controls the weighting of history in determining the basic value. Speaker Name / 24 .11) Use this model when there are no seasonal variations or trend patterns. Title of Presentation.Constant Model – 1st order Exponential Smoothing (10. exBasic value and ex-post forecast are equal Higher alpha puts more weight on recent values Higher alpha makes the forecast more reactive to recent changes in history © SAP AG 2002.

Title of Presentation.Example of a Constant Model © SAP AG 2002. Speaker Name / 25 .

Constant Model – Automatic Adaptation of the Alpha factor (12) The system automatically adjusts the alpha factor based on the initial initial alpha and the smallest tracking signal. Title of Presentation. © SAP AG 2002. Speaker Name / 26 .

the forecast equals the average of the historical periods Weighted Moving Average (14) – the forecast equals the weighted average of the historical periods. Period -5 -4 -3 -2 -1 Weighting 10% 20% 30% 40% 50% © SAP AG 2002.Moving Average Models Two models are within the Moving Average group Moving Average (13) -. Title of Presentation. The weighting is defined via a weighting profile. Speaker Name / 27 .

Speaker Name / 28 . Title of Presentation.Moving Average-Formulas Moving Average-13 Weighted Moving Average-14 No ex-post forecast calculated © SAP AG 2002.

Trend Models There are four models for data with trend: Forecast with Trend Model (20) Holt’ Holt’s Method (21) Same Formula ! 20 = 21 Second Order Exponential Smoothing (22) Trend model with Automatic Alpha Adaptation (2nd order) (23) © SAP AG 2002. Speaker Name / 29 . Title of Presentation.

Speaker Name / 30 .G(t-1) ] + (1-β)T(t-1) β © SAP AG 2002. 21) For mulas Forecast value for period (t +1) Basic Value Trend Value P(t +i) = G(t) + i * T(t) G(t) = αV(t) + (1-α) [ G(t-1) + T(t-1) ] α T(t) = β [(G(t) .Holt’s Method (20. Title of Presentation.

© SAP AG 2002.Second Order Exponential Smoothing (22) Encompasses a double smoothing method where the basic value of the first calculation is used as the input for the second. Speaker Name / 31 . Title of Presentation. The result is a basic value that is more reactive to changes in demand while minimizing the trend effect.

(ET). The minimum Alpha is 0. The system determines the Alpha factor through through an iterative processes of comparing the MAD to the Error Total (ET). Title of Presentation. © SAP AG 2002. (Same Method as Constant with Automatic Alpha Adaptation). Speaker Name / 32 .90.Trend with Automatic Alpha Adaptation (2nd order) (23) This is the same as Second Order Exponential Smoothing except the the systems determines the Alpha value.05 and and the maximum is 0.

© SAP AG 2002.Trend Dampening Profile As the historical values do not show a decrease in trend as the market matures. Title of Presentation. Speaker Name / 33 . a Trend Dampening profile can be used to smooth out the trend.

Title of Presentation. © SAP AG 2002.Seasonal Models Seasonal Models are used to depict a Seasonal forecast or a recurring recurring pattern. The trend value and Beta in this case are zero. The pattern occurs occurs across its season or a number of Seasonal Periods (Usually recommended to be 12 Months). Speaker Name / 34 . without any upwards or downwards slope. signifying no upward or downward slope.

Seasonal Models There are three Models associated with the seasonal patterns. Speaker Name / 35 . Forecast with the Seasonal Model (30) Winter’ Seasonal Trend based on the Winter’s Method (31) Season + Linear Regression (35) Same Formula ! 30 = 31 © SAP AG 2002. Title of Presentation.

Forecast with the Seasonal Model (30) This model uses first order exponential smoothing where both Alpha Alpha and Gamma are assigned. Speaker Name / 36 . © SAP AG 2002. Title of Presentation.

Title of Presentation. Speaker Name / 37 .Season + Linear Regression (35) Seasonal indices calculated Seasonality removed from data Forecast created using linear regression Seasonality added back to forecast © SAP AG 2002.

Seasonal Trend Models There are two Models for the Seasonal Trend method: Forecast with Seasonal Trend Model (40) First Order Exponential Smoothing (41) Same Formula ! 40 = 41 Also know as: Holt-Winters Method And Triple Exponential Smoothing © SAP AG 2002. Speaker Name / 38 . Title of Presentation.

Title of Presentation.21. Speaker Name / 39 . Beta and Gamma Coefficients.30. 41) This Model encompasses the same Formula as 20. © SAP AG 2002.First Order Exponential Smoothing (40.31 and uses assigned values for the Alpha.

Title of Presentation. Speaker Name / 40 .Auto Selection Models Auto Selection 1 (50) Test for Trend and Season (53) Test for Trend (51) Test for Season (52) Seasonal model plus test for Trend (54) Trend Model plus test for Seasonal Pattern (55) Auto Model Selection procedure 2 (56) Same Formula ! 50 = 53 © SAP AG 2002.

Title of Presentation. Seasonal Test: The Auto Correlation Coefficient is Calculated. 53) Tests for Both Seasonal and Trend Patterns. the the Pattern is determined to be Seasonal if the Auto Correlation Coefficient is Greater than 0.Auto Selection 1 (50.3. © SAP AG 2002. Speaker Name / 41 .

a Seasonal Trend Model is used. then the Constant Constant Model is chosen as a default © SAP AG 2002. Title of Presentation. If neither tests is determined to be Significant.Auto Selection 1 (50. 53) A Trend Significance test is carried out If both are determined to be significant. Speaker Name / 42 .

© SAP AG 2002. Title of Presentation.Test for Trend (51) Used to Test only for Trend. This follows the Trend Significance test previously defined. If no Significance is found then a Constant Model is Chosen. Speaker Name / 43 .

© SAP AG 2002. Speaker Name / 44 .Test for Season (52) Used to Test only for Seasonal Pattern. This follows the AutoCorrelation Coefficient Test and choses the Seasonal Model if the value is above 0. If not a Constant Model is Model chosen.3. Title of Presentation.

Seasonal model plus test for Trend (54) Assumes Seasonal pattern exists and tests for Trend pattern. no significance is found than a Seasonal Model is used. If a trend significance is found. Speaker Name / 45 . © SAP AG 2002. then a Seasonal Trend Model is used. If used. Title of Presentation.

Title of Presentation.3 than a Seasonal Trend Model is used. Speaker Name / 46 .Trend Model plus test for Seasonal Pattern (55) Assumes Trend exists and test for a Seasonal Pattern. © SAP AG 2002. if the Seasonal test is not found to be Significant than a Significant Trend Model is used. If the Autocorrelation Coefficient is greater than 0.

Seasonal Model plus test for Trend No Yes Yes by Default Yes by Default If: Season No No Yes Yes N/A Then:Uses Model 10 .Seasonal Trend 40 .Trend 55 .Test for Trend and Season 51 .Auto Selection 1 or 53 .Test for Trend 52 . Speaker Name / 47 .Constant 20 .Constant 30 .Season 40 .Trend 30 .Trend Model plus test for Season Yes No © SAP AG 2002.Summary of the Automodel 1 selection process This shows the Model chosen under the following Conditions: Automodel 50 .Seasonal Trend 30 .Season 40 . Title of Presentation.Constant 30 .Seasonal Trend 20 .Season 10 .Test for Season If:Trend No Yes No Yes Yes No N/A Yes No 54 .Trend 10 .

Auto Model Selection procedure 2 (56) Tests for Constant. The iteration with the Lowest MAD is the Model chosen with the appropriate smoothing factors. Title of Presentation. © SAP AG 2002.1 0. Beta and Gamma between the values of 0..5 in 0. This model adjusts Alpha.1 to 0. Beta and Gamma. Seasonal and/or Trend models while attempting to attempting minimize Error by adjusting Alpha.1 increments while calculating the Mean Absolute Deviation Deviation (MAD) for each Iteration. Speaker Name / 48 .

Seasonal. Gamma) and determining Smallest Mean Absolute Deviation (MAD) Resource Intensive (Not recommended for Production use) Chooses Best Fit of Constant. Title of Presentation. If no Pattern Detected defaults Constant Model © SAP AG 2002. Beta.Comparision between 50 and 56 (Auto model 1 & 2) Auto Selection Model 1 Auto Selection Model 2 Determines Seasonal and Trend Significance through Formulas for Auto Correlation (Seasonal Significance) and Trend Significance Tests Not as precise as Auto Model 2 Determines Best Fit through through Iterative approach of adjusting smoothing factors (Alpha. Seasonal Trend. Speaker Name / 49 . Trend.

The Croston Model (80) The Croston Model (80) is used when demand is sporadic or intermittent. Title of Presentation. The return is a Constant model to meet the possible possible sporadic demand. Speaker Name / 50 . © SAP AG 2002.

© SAP AG 2002.Historical Data Model (60) The Historical Data Model (60) allows you to use your Historical values as your forecast. Title of Presentation. Speaker Name / 51 .

Trend value and Seasonal Seasonal Index. Gamma (from the Profile) and the Basic. Beta. © SAP AG 2002.Manual Forecast (70) The Manual Forecast (70) allows the planner to set their own values to values generate a forecast. Title of Presentation. Beta. This model should not be used for Background Processing. Speaker Name / 52 . The values chosen are all the values that make up the forecast these are the Smoothing coefficients Alpha.

No Forecast (98) No forecast is conducted © SAP AG 2002. Title of Presentation. Speaker Name / 53 .

Speaker Name / 54 . model © SAP AG 2002. Title of Presentation. The external Forecasting feature feature allows you to use ABAP to code your own forecasting model.External Forecast (99) It is also possible to define your own Forecasting model if the model you commonly use is not provided.

Trend. Title of Presentation. Seasonal Trend overview: Formula Explanation of the Variables © SAP AG 2002. Seasonal. Speaker Name / 55 .

Title of Presentation.3 4 Univariate Forecast Basics Univariate Models in APO 5 Forecast Error Analysis © SAP AG 2002. Speaker Name / 56 .

Speaker Name / 57 . Title of Presentation.Forecast Accuracy Measurements Mean Absolute Deviation (MAD) Error Total (ET) Mean Absolute Percentage Error (MAPE) Mean Square Error (MSE) Square Root of the Mean Squared Error (RMSE) Mean Percentage Error (MPE) © SAP AG 2002.

Title of Presentation.Mean Absolute Deviation (MAD) The Mean Absolute Deviation is calculated by the absolute difference difference exbetween the ex-post forecast and the actual value. © SAP AG 2002. The Mean Absolute Deviation is the error calculation used to determine the best fit in the Auto Model 2 Forecasting Model. Speaker Name / 58 .

Speaker Name / 59 . Title of Presentation.Error Total (ET) The Error Total is the sum of the difference between the Actual and Exthe Ex-post forecast. © SAP AG 2002.

Speaker Name / 60 . Title of Presentation. © SAP AG 2002.Mean Square Error (MSE) The Mean Square Error is the Average of the sum of the square of exeach difference between the ex-post forecast and the Actual value.

Mean Absolute Percentage Error (MAPE) The Mean Absolute Percentage Error is the Average Absolute Percent Percent Error between the Actual Values and their corresponding Ex-post ExForecast Values. Title of Presentation. Speaker Name / 61 . © SAP AG 2002.

© SAP AG 2002.Root mean Square Error (RMSE) The Root Mean Square Error is the Square root of the average of the sum of the squared difference between the Actual and Ex-post ExForecast value. Speaker Name / 62 . Title of Presentation.

© SAP AG 2002. Speaker Name / 63 . Title of Presentation.Mean Percentage Error (MPE) The Mean Percentage Error is the average percentage error of the Exdifference between the Ex-post Forecast and the Actual values.

Speaker Name / 64 .Thank You © SAP AG 2002. Title of Presentation.