Forecasting
Forecasting — demand and time-series prediction methods that feed Production Planning and Control, Inventory Control, and Operations Research decisions.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Forecasts drive production planning, capacity loading, procurement, inventory levels, and staffing in factories and supply chains. Better forecasts reduce stockouts and excess inventory, cut costs, and improve service levels — critical for PPC, Inventory Control, Scheduling and Sequencing, and MRP decisions.
Key ideas
- Forecasting: Estimating future values of a variable (e.g., demand) using past data and/or causal information. Horizons: short-term (days–months, for scheduling and inventory), medium-term (months–year, for aggregate planning), long-term (years, for capacity and Facility Location).
- Time series components:
- Level (baseline average), Trend (long-term increase/decrease), Seasonality (regular periodic fluctuation within a year/period s), Cyclical (multi-year business cycles), Random/Irregular (unpredictable noise).
- Additive model: A_t ≈ Level + Trend + Seasonality + Random (useful when seasonal amplitude is roughly constant).
- Multiplicative model: A_t ≈ (Level + Trend) × Seasonality × Random (useful when seasonal amplitude scales with level).
- Time-series vs causal models:
- Time-series (Naive, Moving Average, Exponential Smoothing, Holt, Holt–Winters) assume the future depends mainly on past values; errors are assumed zero-mean white noise.
- Causal/Regression models relate demand to explanatory variables (price, income, promotions) — used when such drivers are known.
- Sign convention for error: We take forecast error as e_t = A_t − F_t (positive means we under-forecasted). Some texts define e_t = F_t − A_t; always check which convention is used and stay consistent in calculations.
- Smoothing constants: α, β, γ ∈ (0, 1) control responsiveness to new data (higher value = more reactive, less smoothing). They are chosen by minimizing an error metric (e.g., MSE, MAPE) on historical data or via holdout validation.
- Moving Average (MA_k): Average of last k actuals. Smooths random noise but lags trend; larger k gives more smoothing and more lag.
- Weighted Moving Average (WMA): Assigns higher weights to recent periods; weights sum to 1.
- Simple Exponential Smoothing (SES): Best for level-only (no trend/seasonality) series. Recursion updates the last forecast with a fraction α of last error. Limiting cases: α → 1 makes F_{t+1} close to the naive forecast A_t; α → 0 freezes the forecast near its initial value.
- Holt’s linear method (double exponential smoothing): Adds a trend component. It separately updates level and trend with α and β, forecasting m steps ahead as L_t + m T_t. Limiting cases: β → 0 freezes trend; with β → 1 trend reacts strongly to latest change.
- Holt–Winters (triple exponential smoothing): Handles trend and seasonality with period s.
- Multiplicative: suitable when seasonal variation grows with level. Uses seasonal indices S_t that repeat every s periods.
- Additive: suitable when seasonal amplitude is roughly constant.
- Limiting cases: γ → 0 freezes seasonality; γ → 1 overwrites seasonal index with latest seasonal ratio/residual.
- Seasonal indices: Factors (multiplicative) or values (additive) repeating every s periods. Estimated by ratio-to-moving-average or by normalizing averages of like seasons. For multiplicative, indices typically normalize to average 1 over s.
- Deseasonalization/Reseasonalization: To fit a trend or regression, remove seasonality (e.g., divide by index for multiplicative; subtract for additive), fit the model, then reapply seasonality to forecasts.
- Regression forecasting: For a linear time trend y_t = a + b t, estimate a and b by least squares on deseasonalized data (if seasonal), then reseasonalize. For causal models, include predictors x (e.g., price), but ensure the forecast horizon has assumed or forecasted x.
- Accuracy and bias metrics:
- Error e_t = A_t − F_t.
- Mean Absolute Deviation (MAD) = average of |e_t|; same units as demand.
- Mean Squared Error (MSE) = average of e_t^2; penalizes large errors.
- Root MSE (RMSE) = sqrt(MSE); same units as demand.
- Mean Absolute Percentage Error (MAPE) = average of |e_t/A_t| × 100%; undefined if A_t = 0; sensitive to small A_t.
- Tracking Signal (TS) = RSFE/MAD, where RSFE = Σ e_t; used to detect bias (persistent over/under-forecasting). Control limits vary by practice (commonly ±4 or ±5).
- Assumptions behind models:
- Errors are independent, zero-mean, often assumed homoscedastic.
- Time-series structure (level/trend/seasonality) is stable over the forecast horizon considered.
- For regression: linearity in parameters; exogenous regressors are known or forecasted; residuals uncorrelated for valid inference.
- Initialization:
- SES: choose F_1 (e.g., A_1 or mean of first few observations).
- Holt: L_1 = A_1 (or mean of first few), T_1 = A_2 − A_1 (or average of first differences over the first k periods).
- Holt–Winters: initialize L_1 and T_1 as above; estimate initial seasonal indices from the first s (or multiple s) observations by normalizing.
- Why real data deviate from ideal: Structural breaks (new product, policy change), promotions, stockouts (observed demand < true demand), holidays, and autocorrelation in residuals can violate assumptions; parameters may drift, requiring re-estimation and model monitoring.
Formulas
e_t = A_t − F_t
- e_t: forecast error (units), A_t: actual at t (units), F_t: forecast for t made at t−1 (units). Sign convention used here: positive means under-forecast. Applies to any forecasting method.
F_{t+1} = A_t
- Naive forecast. F_{t+1}: next forecast (units), A_t: last actual (units). Good baseline; optimal for random walk.
F_{t+1} = α A_t + (1 − α) F_t = F_t + α (A_t − F_t)
- Simple Exponential Smoothing (SES). α ∈ (0, 1). Units: units for F and A. Use when level-only series (no trend/seasonality).
F_{t+m} = L_t + m T_t
- Holt linear forecast m steps ahead. L_t: level at t (units), T_t: trend at t (units per period), m: steps (dimensionless). Use with linear trend and no seasonality.
L_t = α A_t + (1 − α)(L_{t−1} + T_{t−1})
- Holt level update. α ∈ (0, 1). Units: L_t in units.
T_t = β (L_t − L_{t−1}) + (1 − β) T_{t−1}
- Holt trend update. β ∈ (0, 1). Units: T_t in units/period.
L_t = α (A_t / S_{t−s}) + (1 − α)(L_{t−1} + T_{t−1})
- Holt–Winters multiplicative: level update. s: season length (periods). Use when seasonality scales with level.
S_t = γ (A_t / L_t) + (1 − γ) S_{t−s}
- Holt–Winters multiplicative: seasonal index update. S_t dimensionless (average ≈ 1 over s). γ ∈ (0, 1).
F_{t+m} = (L_t + m T_t) S_{t−s+m}
- Holt–Winters multiplicative m-step forecast. Units: units.
L_t = α (A_t − S_{t−s}) + (1 − α)(L_{t−1} + T_{t−1})
- Holt–Winters additive: level update. S_t in units (averages ≈ 0 over s). Use when seasonal amplitude is constant.
S_t = γ (A_t − L_t) + (1 − γ) S_{t−s}
- Holt–Winters additive: seasonal update. Units: units.
F_{t+m} = L_t + m T_t + S_{t−s+m}
- Holt–Winters additive forecast. Units: units.
MA_k(t+1) = (A_t + A_{t−1} + … + A_{t−k+1}) / k
- Simple moving average of window k. Units: units. Use for level-only with noise; larger k gives more smoothing but more lag.
WMA(t+1) = Σ_{i=1..k} w_i A_{t−i+1}, with Σ w_i = 1
- Weighted moving average. Units: units. Weights w_i dimensionless, sum to 1.
MAD = (1/n) Σ |e_t|
- Mean Absolute Deviation. Units: units. Robust to outliers compared to MSE.
MSE = (1/n) Σ e_t^2
- Mean Squared Error. Units: units^2. Penalizes larger errors.
RMSE = sqrt(MSE)
- Root Mean Squared Error. Units: units. Interpretable like standard deviation of errors.
MAPE = (100/n) Σ |e_t / A_t|
- Mean Absolute Percentage Error. Units: percent. Undefined when any A_t = 0.
RSFE = Σ e_t, TS = RSFE / MAD
- Running Sum of Forecast Errors and Tracking Signal. RSFE units: units; TS dimensionless. Used for bias monitoring.
b = [n Σ (t Y_t) − (Σ t)(Σ Y_t)] / [n Σ t^2 − (Σ t)^2], a = (Σ Y_t − b Σ t)/n
- Least-squares slope and intercept for linear trend Y_t = a + b t. Y_t units: units (or deseasonalized units). t is dimensionless time index. Use after deseasonalizing if seasonal.
Deseasonalized = A_t / S_t (multiplicative), Reseasonalized = Forecast × S_t
- For multiplicative seasonality. S_t dimensionless seasonal index.
Worked examples
Example 1 — Direct: Simple Exponential Smoothing forecast and MAD Given: Actual demand (units) over 6 periods: A1=110, A2=130, A3=120, A4=140, A5=135, A6=150. SES with α=0.3. Initial forecast F1=100 (units). Find F7 and MAD over periods 1–6.
Steps:
- Use SES update: F_{t+1} = F_t + α(A_t − F_t); error e_t = A_t − F_t.
- Iterate period by period (units carried):
- t=1: F1=100. e1=110−100=10 units. F2=100+0.3×10=103.0 units.
- t=2: e2=130−103.0=27.0 units. F3=103.0+0.3×27.0=111.1 units.
- t=3: e3=120−111.1=8.9 units. F4=111.1+0.3×8.9=113.77 units.
- t=4: e4=140−113.77=26.23 units. F5=113.77+0.3×26.23=121.639 units.
- t=5: e5=135−121.639=13.361 units. F6=121.639+0.3×13.361=125.6473 units.
- t=6: e6=150−125.6473=24.3527 units. F7=125.6473+0.3×24.3527=132.95311 units.
- Compute MAD over t=1..6: |e| sum = 10 + 27 + 8.9 + 26.23 + 13.361 + 24.3527 = 109.8437 units. MAD = 109.8437 / 6 = 18.3073 units.
Answer: Next forecast F7 = 132.95 units; MAD over 6 periods = 18.31 units.
Example 2 — GATE style: Multiplicative seasonality + linear trend via regression, then reseasonalize Given: Quarterly demand (units) for 2 years (t=1..8), with known seasonal indices for multiplicative seasonality: S_Q1=0.80, S_Q2=1.00, S_Q3=1.20, S_Q4=1.00. Actuals:
- Year 1: Q1 (t=1) A1=120, Q2 (t=2) A2=150, Q3 (t=3) A3=180, Q4 (t=4) A4=150
- Year 2: Q1 (t=5) A5=130, Q2 (t=6) A6=165, Q3 (t=7) A7=195, Q4 (t=8) A8=165 Task: Fit a linear trend to deseasonalized data Y_t = a + b t and forecast Year 3, Q1 (t=9). Then reseasonalize with S_Q1=0.80.
Steps:
- Deseasonalize using multiplicative indices: Y_t = A_t / S_t.
- t=1 (Q1): 120/0.80 = 150.0 units
- t=2 (Q2): 150/1.00 = 150.0 units
- t=3 (Q3): 180/1.20 = 150.0 units
- t=4 (Q4): 150/1.00 = 150.0 units
- t=5 (Q1): 130/0.80 = 162.5 units
- t=6 (Q2): 165/1.00 = 165.0 units
- t=7 (Q3): 195/1.20 = 162.5 units
- t=8 (Q4): 165/1.00 = 165.0 units
- Compute sums for least-squares (n=8):
- Σ t = 1+…+8 = 36 (dimensionless)
- Σ t^2 = 204
- Σ Y = 150+150+150+150+162.5+165+162.5+165 = 1255.0 units
- Σ tY = (1×150) + (2×150) + (3×150) + (4×150) + (5×162.5) + (6×165) + (7×162.5) + (8×165) = 5760.0 units
- Estimate slope and intercept:
- b = [n Σ(tY) − (Σ t)(Σ Y)] / [n Σ t^2 − (Σ t)^2] = [8×5760 − 36×1255] / [8×204 − 36^2] = (46080 − 45180)/(1632 − 1296) = 900/336 = 2.6786 units/quarter.
- a = [Σ Y − b Σ t]/n = [1255 − 2.6786×36] / 8 = (1255 − 96.4286)/8 = 144.8214 units. Thus, deseasonalized trend: Ŷ_t = 144.8214 + 2.6786 t.
- Forecast deseasonalized value at t=9 (Year 3, Q1): Ŷ_9 = 144.8214 + 2.6786×9 = 168.9286 units.
- Reseasonalize for Q1 with S_Q1=0.80: F_9 = Ŷ_9 × 0.80 = 168.9286 × 0.80 = 135.1429 units.
Answer: Forecast for Year 3, Q1 = 135.14 units (multiplicative seasonal model with linear trend).
Common mistakes
- Forgetting to center moving averages for even seasonal periods when computing seasonal indices (e.g., 4-quarter CMA must be centered between two quarters) — otherwise indices are biased.
- Using additive seasonality when multiplicative is appropriate (or vice versa): check if seasonal amplitude grows with level; choose accordingly.
- Applying MAPE when actuals can be zero or near-zero; MAPE then explodes or is undefined. Use MAD/RMSE or sMAPE variants instead.
- Comparing models on in-sample error only; not using a holdout period or cross-validation to select α, β, γ or window k.
- Rounding intermediate values too aggressively in recursive smoothing; carry adequate precision and round only final answers.
- Failing to re-estimate parameters after a structural break (e.g., major price change, product redesign). Old parameters give biased forecasts.
- Confusing Holt vs Holt–Winters updates or using wrong seasonal index (e.g., S_{t} instead of S_{t−s}) in multiplicative formulas.
For GATE ME
- Quick numericals on SES: given α, initial forecast, and a short series of actuals, compute next forecast and an error metric (MAD/MSE/MAPE). Practise step-by-step updates and carry units.
- Moving average vs weighted moving average: compute a k-period MA or WMA forecast; reason about lag and responsiveness; choose k to reduce noise vs follow trend.
- Holt’s linear method: compute 1–2 update steps (L_t and T_t) and forecast m periods ahead. Be comfortable with the update sequence and units.
- Seasonal forecasting: given seasonal indices, deseasonalize data, fit a linear regression trend, then reseasonalize to forecast specific future seasons. Practise both additive and multiplicative cases.
- Regression-based trend: compute least-squares a and b quickly using Σt, ΣY, Σt^2, ΣtY, and forecast at t = n + m. Check units and whether deseasonalization is required.
- Model selection via accuracy: compute MAD/MSE/MAPE for given competing forecasts; identify bias with RSFE and tracking signal; state if action is needed when TS exceeds limits.
- Conceptual: identify appropriate model for given pattern (level-only, trend, seasonality), state assumptions, and comment on the effect of parameter choices (e.g., α close to 1).
Quick check
- If e_t = A_t − F_t is the error definition, what does a positive tracking signal indicate about bias?
- In SES, what happens to F_{t+1} as α → 1?
- With multiplicative seasonality: deseasonalized trend forecast is 200 units for a month whose seasonal index is 1.25. What is the reseasonalized forecast?
Answers: 1) Persistent positive errors (under-forecasting; forecasts too low). 2) F_{t+1} tends to the naive forecast A_t (maximally reactive). 3) 200 × 1.25 = 250 units.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?