In any production environment, demand forecasting plays a key role for managing integrated logistics systems. It provides valuable information for several basic logistics activities including purchasing, In-house production, inventory management, transportation etc. There are extensive forecasting techniques available for anticipating the demand, but in this blog let me introduce the different forecasting methodologies at high level and explain causal analysis (Multi-linear regression method) in detail.

**Different Forecasting methodologies include**

- Subjective Forecasting
- Objective Forecasting

**Subjective Forecasting – Qualitative technique**

The approach relies most heavily on judgment and educated guesses, since there would be very little data available for forecasting. This is especially the case in long-range forecasting. It’s easy to forecast next week’s forecast, since we’ll have months or years data to forecast. However, if we’re trying to get an idea forecast a product which is about to be 10 years from now, we would not have much quantitative variables to predict a demand for such a long horizon. There is a likelihood for a Change in technology, and political, economic, and social factors occur and change in the course of trends. Hence, the opinion of subject matter experts would be required who have a good intuition about the past sales. There is essentially only one category of subjective forecast approaches which is called “Judgmental” forecasts, such a forecasting model is not available in SAP IBP as the business would never use such an expensive tool to manage forecast with very huge horizon (>3 Years).

**Objective Forecasting**

Objective forecasting approaches are **quantitative** in nature and it is chosen when there is an abundance of data. There are three categories of objective forecasting methods: Time series, Classification, and Causal.

**Time Series Methods**

Time series methods attempts to estimate future outcome based on historical data. In many cases, prior sales of a product can be a good predictor of upcoming sales because of prior period marketing efforts, repeat business, brand awareness, and other factors. Whenever a time series method is chosen then we assume that the future will continue to look like the past. In rapidly changing industries or environments, time series forecasts are not ideal, and may be useless.

Because time series data are historical, they exhibit four components that emerge over time: trend, seasonal, cyclical, and random (or irregular). Before any forecasting is done on time series data, the data must be cleansed to perform downstream analysis.

For Data Cleansing, please refer my previous blog.

https://blogs.sap.com/2019/03/31/data-cleansingoutlier-correction-methods-in-ibp-demand/

The most common time series methods include

Simple moving average

Exponential smoothing

Arima Methods

**Classification Analysis**

Classification analysis is used when we are intended to predict the outcome of a variable which is categorical, in such cases we to predict the outcome of those variables by using forecast methods such as Decision Trees, Random Forecast etc.

**Causal Analysis**

Causal or econometric forecasting methods attempt to predict outcomes based on changes in factors that are intended to impact those outcomes. For example, temperature may be used to forecast sales of ice cream; advertising expenditures may be used to predict sales. It reminds me a Statistical Proverb

“Correlation Doesn’t necessarily need to causation” – Just because two variables are correlated, it doesn’t need to cause each other For Example: During Summer in India, on a particular shop there was a huge sale on sweater from people travelling US, and it doesn’t mean that the same would prevail in next summer. So, Choosing the correct predictor (Dependent) and explanatory (Independent) variable plays an important role

In this blog, I would be explaining in detail about one of the most widely used Casual analysis Forecast model called “Multi-Linear Regression”.

**Regression:** Regression helps us to find the relationship between two variables, unlike correlation it shows the trend that exist between two variables.

**Simple Linear Regression:**

The Simple Linear Regression uses one explanatory (Independent) variable which helps us to predict the predictor (Independent) variable. Based on the trend of an explanatory variable, the predictor variable would either be on an increasing or decreasing trend.

**Increasing Trend**

**Decreasing Trend**

The Line that passes over the above graph’s are nothing but the “Line of Best Fit or the Regression Line”

**Line of Best Fit: **The line of best fit is used to describe the data, and it is used to make predictions.

**The Simple Linear Regression is normally computed using the Regression Equation**

Y = mx + C

Y – Independent Variable

X – Dependent Variable

M – Slope of the Regression line

C – Y-Intercept of the Regression line

** **

**Slope:** It explains the change in the value of Dependent variable when there is a corresponding change in the value of Independent variable by one unit.

**Y-Intercept: **It explains the value of our dependent variable when our independent variable is exactly zero.

The Simple linear regression would serve as base for explaining the Concept of Multi-linear regression used in SAP IBP. Unlike one explanatory (Independent) variable, the Multi-linear regression uses more than one explanatory variable in order to predict a dependent variable.

The most Important thing in any casual analysis is to understand the data. Understanding data means we should be aware of what each variable in the dataset describes. In many cases, not a single variable will cause the dependent variable to either increase or decrease but a combination of the independent variable will cause the dependent variable to either go up or go down.

**Key Assumptions when using the Linear Regression technique**

- Linearity in data
- Homoskedasticity
- Multivariate normality
- Independence of Errors
- Lack of Multi-collinearity

Before choosing a linear regression model, we should find out whether these assumptions are true only if it is true then we should proceed on choosing the model.

**Statistical Equation for Multi Linear Regression**

Y = m_{1}x_{1} + m_{2}x_{2} + m_{3}x_{3} +…. +m_{n}x_{n} + C

**Building a Forecast Model for MLR in SAP IBP**

For MLR, adding the key figures for the forecast and ex-post forecast, we need to make the following setting to use the multiple linear regression algorithm in our forecast model

- Variable Selection
- Key figures
- System Generated Features

**Variable Selection**

The setting defines how the system must choose the independent variables that have a significant influence on the forecast. You have the following options:

- Backward Selection (I.e. Backward Elimination)
- Forward Selection
- None

**Backward Selection (Backward Elimination)**

If you select this option, the system takes all independent variables into consideration at the beginning of the forecast calculation and one by one excludes all factors that are irrelevant for the forecast.

**Forward Selection**

If you select this option, the system starts with one independent variable, then add the others one by one until it identifies all factors that are relevant for the forecast.

This is bit more complicated from technical perspective to compute the results with the forward selection method..

**None**

With this method, the system considers all variables to the forecast model.

** **

**Key Figures**

The independent variables that should be considered by the algorithm as external factors when it calculates the forecast.

**Note: The number of historical periods must be 2 more than the number of independent variables as per SAP Recommendation.**

**System-Generated Features**

Independent variables that are generated on the fly during forecasting. The following features are available:

**Slope Dummy – To Consider Trend in the data**

If we select this feature, the algorithm can consider the effects of trends on the forecast even when those trends can’t be explained by any known independent variables.

The values of this variable increase by 1 from one period to the other so they form a 45-degree slope in a chart in which axis ‘x’ contains the time periods, axis ‘y’ contains time series values for the input key figure, and the intercept is always 0.

The algorithm multiplies the values of the slope dummy variable with a regression coefficient, which is calculated in a way that the modified values are as close to the historical values as possible.

This allows the system to predict trend values for the future and calculate a forecast that takes the trend into consideration.

**Month of the Year – To Consider the Seasonality in the data**

If we select this feature, the system creates an additional independent variable during runtime that describes for each period the month to which it belongs. When this variable is added to monthly, weekly or daily data, it helps the system capture some of the seasonal impact that occurs regularly each year (for example, larger sales occur in each December).

It allows the algorithm to come up with monthly estimates for the future forecast.

**IBP Configuration-Manage Forecast Models App**

**In the general tab of Forecasting models app, we will define the periodicity between Day to year based** on the Keyfigure selection. No. of Past data will be based on the Historical periods and Independent variables. Future calculation will be based on Forecast periods (Ex: Statistical FCST).

In the above Forecasting step we will define the Input and Target KFs for calculation. For MLR we will also add 1 or more KFs considered as Independent variables. Dependent variable will be our Statistical forecast(output) in the future and historical sales from the past.

__MLR output after Forecasting in Excel Planning view__

In the above example, Statistical Fcst of Current week is calculated based on change in the Independent variables and Historical data.

Post processing concepts will be covered in separate blogs.

**References**

For more Information regarding Multi-linear regression working logic in SAP IBP, please refer the below link

https://help.sap.com/viewer/2cfbc5cf2bc14f028cfbe2a2bba60a50/2.0.04/en- US/eedc9094daf04419bc25f6ed097ac03b.html

Nice blog to understand the MLR model.

Best Regards,

Lingaiah