| # Algorithm for demand forecasting LN calculates the demand forecast on the basis of the historical demand with the following algorithm. The main steps of the calculation are: Retrieve the demand history. Check the demand history. Determine the trend factor. Determine the seasonal pattern. Forecast the demand. Compute forecast errors and the seasonal correlation. Convert the demand forecast to plan periods. In the following sections, each calculation step will be explained. 1. Retrieve the demand history The demand forecast is based on the historical demand data in the time period between the start date of the scenario and the current plan period. Historical demand data consists of the following fields in the Item Master Plan (cprmp2101m000) session or the Channel Master Plan (cpdsp5130m000) session: Sched Prod Receipts Internal Deliveries (*) (*) Only taken into account if the Dependent Demand Forecast check box in the Items - Planning (cprpd1100m000) session is selected. LN converts the demand history in the current master plan from plan periods to fixed-length forecast periods, based on the Forecast Period Length field in the Scenarios (cprpd4100m000) session. See To distribute master-plan quantities over calendar days. Adjusting for non-working days LN increases the actual demand with a fictitious demand for non-working days, such as holidays, to prevent demand fluctuations. The fictitious demand is equal to the average demand in the forecast period. The calendar of the item's enterprise unit (see the Items - Planning (cprpd1100m000) session) defines which days are workdays. LN reverses the adjustment in the final step of the calculation, when the demand forecast is converted back to plan periods. 2. Check demand history After LN retrieves the available demand history for a plan item, it checks whether the demand history is sufficient to perform a demand forecast. LN counts the forecast periods from the first period with actual demand up to the current period. The criteria for the minimum number of forecast periods depend on the applied forecast method and the seasonal cycle time. If the history data does not suffice, LN aborts the demand forecast calculation, and reports the reason. 3. Determine trend factor Determination of the trend factor depends on: Type of Trend Influence Type of Seasonal Influence These parameters are located in the Plan Items - Forecast Settings (cpdsp1110m000) session. In the following part of this text, it is assumed that the Automatic Update of Forecast Parameters check box is cleared. The effect of the automatic update of forecast parameters is described later. Linear If the Type of Trend Influence field is Linear, the trend influence can be described by means of the following formula:
     FD(t) = CS + TF *	t
Where CS = constant demand TF = trend factor FD(t) = the demand forecast for period t LN calculates the trend factor (TF) and the constant demand (CS), based on a first degree polynom by means of polynomial regression. See Principle of polynomial regression. If there is a seasonal cycle, LN determines the first degree polynom on the basis of a whole number of seasonal cycles. Progressive If the Type of Trend Influence field is Progressive, the trend influence can be described by means of the following formula:
     FD(t) = BS * (TF ^ (t-1))
Where BS = base demand (the estimated demand for period 1) TF = trend factor FD(t) = the demand forecast for period t LN determines the trend factor (TF) and the base demand (BS) with the following calculation: The calculation is based on the first and the last period with demand history. If a seasonal influence exists, two periods, which lie a whole number of seasonal cycles apart, are selected. The estimated demand of the selected periods is determined by using a second degree polynom. LN determines this polynom with polynomial regression. If a second degree polynom cannot be determined, the actual demand in the first and last period with demand history is used instead of the estimated demand. The trend factor and base demand are calculated as follows:
BS | base demand
TF | trend factor
ED(t1) | the estimated demand in the first period with demand history
ED(t2) | the estimated demand in the last period with demand history
n | number of demand history periods minus 1
Not Applicable If the Type of Trend Influence field is Not Applicable, the trend factor is not used. Note LN checks whether a trend is present. LN reports the following situations without actually changing the type of trend influence: The Type of Trend Influence field is Linear or Progressive, but no trend can be detected. The Type of Trend Influence field is Not Applicable, but a trend is detected anyway. Automatic Update of Forecast Parameters If the Automatic Update of Forecast Parameters check box in the Plan Items - Forecast Settings (cpdsp1110m000) session is selected, LN performs an automatic trend detection. If the Type of Trend Influence field is Linear or Not Applicable, LN calculates a trend factor according to the method for linear trends. If the trend factor is found to be zero, LN sets the Type of Trend Influence field to Not Applicable. LN reports any automatic change of the Type of Trend Influence field. 4. Determine seasonal pattern A seasonal pattern is defined by a series of seasonal factors: one seasonal factor for each forecast period in a seasonal cycle. If you specified a fixed seasonal pattern in the Seasonal Pattern for Forecast field in the Items - Ordering (tcibd2500m000) session, LN determines the seasonal factor for each period based on the seasonal factors defined at the execution level. If the Seasonal Pattern for Forecast field is empty, LN determines the seasonal pattern on the basis of the trend-adjusted demand history. The determination of the seasonal pattern based on the demand history depends on the following fields in the Plan Items - Forecast Settings (cpdsp1110m000) session: Type of Seasonal Influence Seasonal Cycle Time Automatic Update of Forecast Parameters If the Automatic Update of Forecast Parameters check box is selected, LN can update the following fields automatically: Type of Seasonal Influence Seasonal Cycle Time The seasonal factors are calculated as follows:
    (1) TD(t) = AV
    (2) TD(t) = CS + TF * t
    (3) TD(t) = BS * TF ^ (t-1)
(1) | without seasonal influence
(2) | with linear trend influence
(3) | with a progressive trend influence
(*) | The average demand is determined as the sum of the historical demand figures per period divided by the number of periods with demand history.
Where:
TD(t) | the trend based demand
AV | average demand
CS | constant demand
BS | the estimated demand for period 1
TF | trend factor
Constant If the Type of Seasonal Influence field is Constant, the seasonal factor is equal to the actual demand reduced by the trend-adjusted average demand for the relevant period. This is calculated as follows:
     SF(t) = AD(t) -	TD(t)
Where:
SF(t) | the seasonal factor for period t
AD(t) | the actual demand for period t
TD(t) | the trend based demand for period t
Progressive If the Type of Seasonal Influence field is Progressive, the seasonal factor is equal to the actual demand divided by the trend-adjusted average demand for the period concerned. This is calculated as follows:
     SF(t) = AD(t) /	TD(t)
Where:
SF(t) | the seasonal factor for period t
AD(t) | the actual demand for period t
TD(t) | the trend based demand for period t
The above seasonal factor is computed as an average seasonal factor for each period. Note LN checks whether a seasonal pattern is present. LN reports the following situations: The Type of Seasonal Influence field is Constant or Progressive, but no seasonal pattern can be detected. The Type of Seasonal Influence field is Not Applicable, but a seasonal pattern is detected anyway. A seasonal pattern is assumed to be present, if the value of the Seasonal Correlation Factor field is at least 0.8. If the Automatic Update of Forecast Parameters check box is selected and one of the above-mentioned situations presents itself, LN changes the Type of Seasonal Influence field accordingly. Automatic Update of Forecast Parameters If the Automatic Update of Forecast Parameters check box in the Plan Items - Forecast Settings (cpdsp1110m000) session is selected, LN performs an automatic seasonal pattern detection. If the Type of Seasonal Influence field is Constant or Not Applicable, LN calculates a seasonal pattern according to the method for Constant patterns. If no seasonal pattern is detected, LN sets the Type of Seasonal Influence field to Not Applicable. If the Type of Seasonal Influence field is Progressive, LN calculates a seasonal pattern according to the method for Progressive patterns. If no pattern is detected, LN sets the Type of Seasonal Influence field to Not Applicable. LN reports any automatic change of the Type of Seasonal Influence. 5. Forecast the demand LN applies the forecast method that you specified in the Forecast Method field in the Plan Items - Forecast Settings (cpdsp1110m000) session. 6. Compute forecast errors and seasonal correlation After LN forecasts the demand for a plan item, it determines the following error and correlation information: Average Forecast Error Mean Absolute Deviation Mean Relative Deviation Standard Deviation Seasonal Correlation Factor This information is displayed in the Plan Items - Forecast Settings (cpdsp1110m000) session. 7. Convert demand forecast to plan periods LN converts the computed demand forecast for the forecast periods from a fixed period length to plan periods with a variable period length. This process is the reverse of the first step Retrieve demand history). Adjusting for non-working days LN treats workdays and non-working days differently. The calendar of the company calendar provider defines which days are workdays. Concretely, this means that a demand forecast for a day with zero available capacity is ignored, so that no demand forecast is generated for public holidays and other days off. Related topics To compute the demand forecast Principle of polynomial regression Forecasting methods Forecast errors and seasonal correlation |