Overview

BSc Mathematics Project

Forecast demand before the shelf empties.

An ARIMA model turns historical sales into a demand forecast, then sizes safety stock and the reorder point from it.

Historical monthly demand with a six-month ARIMA forecast and 95 percent confidence interval
Six-month forecast, ARIMA(1, 0, 1), fitted on 19 monthly periods.
5,000 Transactions analysed 2023-03-16 to 2024-11-04
19 Complete monthly periods 11 categories, 51 products
3.53% Forecast error (MAPE) Accurate Forecast (MAPE < 10%)
17.68 Mean absolute error Measured on 5 unseen periods

How the system works

  1. 1

    Aggregate

    Merge orders, line items and products, then resample to a gap-free monthly demand series.

  2. 2

    Test and difference

    Run the ADF test repeatedly to find the smallest d that makes the series stationary.

  3. 3

    Fit ARIMA

    Read ACF and PACF to choose p and q, then estimate coefficients by maximum likelihood.

  4. 4

    Forecast

    Project six periods ahead with a 95% confidence interval, clipped at zero.

  5. 5

    Reorder

    Size safety stock and the reorder point from the forecast, then raise a low-stock alert.

What the model decides

The forecast is not the deliverable. The stocking decision is. Three quantities turn a predicted demand figure into an instruction a warehouse can act on.

Safety stock
Buffer that absorbs demand variance across the supplier lead time, sized by the service level you choose.
Reorder point
The stock level at which a replenishment order must be placed to avoid running out before delivery.
Order quantity
The batch size that minimises ordering cost and holding cost together.

Built with

  • Python 3.12Runtime
  • FlaskRoutes and views
  • pandasMerging and resampling
  • statsmodelsADF and ARIMA
  • SciPyService-level z-scores
  • MatplotlibAll charts