Regression and Forecasting
Regression and Forecasting
Conditional mean, not automatic causality
A regression model may write daily orders as
describes a conditional relationship under the model. Calling it the effect of temperature or promotion requires assumptions about omitted causes, selection, timing and functional form.
Small fitted example
The following five-day dataset is a calculation exercise, not empirical evidence:
| Temperature °C | Orders |
|---|---|
| 10 | 120 |
| 12 | 126 |
| 14 | 133 |
| 16 | 141 |
| 18 | 150 |
For simple least squares,
Fit and audit a simple regression
The fitted slope is about 3.75 orders per degree within this narrow sample. Extrapolating to 35°C or claiming a causal response is unsupported.
Forecast origin and horizon
A forecast is indexed by both origin and horizon :
The information set must be frozen. A Monday replenishment forecast may use weather forecasts issued by Monday, not realised Thursday weather.
Choose loss from consequences
| Metric | Formula idea | Boundary |
|---|---|---|
| MAE | mean $ | y-\hat y |
| RMSE | square-root mean squared error | emphasises large misses |
| MAPE | mean percentage error | unstable near zero |
| weighted absolute percentage | $\sum | e |
| pinball loss | asymmetric quantile error | useful for service/stock trade-offs |
If under-forecasting fresh milk costs more than over-forecasting canned goods, a single unweighted RMSE can select the wrong operational model.
Point and distribution
Inventory and staffing require uncertainty, not just a point. Report quantiles or prediction intervals and test their empirical coverage.
A nominal 90% interval should contain roughly 90% of comparable future outcomes. Coverage alone is not enough: an interval covering everything is uselessly wide. Compare calibration and sharpness.
Residual audit
Plot or tabulate residuals against:
- fitted value and key inputs;
- time and forecast horizon;
- store, product and channel;
- promotion and disruption periods;
- missingness patterns.
Systematic residuals are information the model failed to encode or a sign that the data-generating process changed.
Quick check
Model A has lower daily RMSE; Model B has lower shortage cost in a replenishment simulation. Which wins?
Answer
For deeper dynamic modelling, continue to the dedicated Time Series course.