Forecasting Critical Drug Demand with Markov Models

Context

A Paraguayan public hospital faced recurrent shortages of chronic cardiovascular medications. Demand was volatile, and procurement didn’t rely on data.

I built a Markov-chain forecasting system to anticipate shortages and guide inventory decisions.

What I Built

A forecasting engine that:

  • Models patient consumption patterns using Markov states

  • Predicts future demand for critical medications

  • Provides early alerts on stockouts

  • Converts patient transitions directly into pill-level demand forecasts

Approach

  1. Analyzed historical withdrawal records for four major cardiovascular drugs

  2. Defined discrete consumption states + transition probabilities

  3. Evaluated four Markov-based model configurations

  4. Validated accuracy with MAPE across rolling windows

  5. Translated state forecasts into drug-level demand and inventory trajectories

Key Findings

  1. Found that a model incorporating additive expansion factors to capture population shifts delivered the most consistent accuracy across drugs and evaluation windows.

  2. The system predicted a cardiovascular drug stockout four months in advance

  3. Markov transitions revealed hidden patient-behavior patterns influencing demand

  4. Model performance varied by drug, highlighting the need for flexible model selection

Impact

  • Enabled earlier procurement decisions to reduce stockout risk

  • Improved inventory reliability without increasing cost

  • Introduced a repeatable forecasting workflow applicable to other chronic conditions (e.g., insulin)

  • Provided leadership with a data-driven planning tool instead of reactive ordering

Tools & Techniques

Markov Chains • Stochastic Processes • Demand Forecasting • Python

Next
Next

How to Optimize Prices With Data: An Algorithmic Approach