Hierarchical Bayesian price elasticity modelling to plan grocery prices and promotions
A price and promotion planner: hierarchical Bayesian elasticities, including how a discount on one product takes sales from its neighbours, show the volume, revenue and margin of any price, with uncertainty.
Background
A discount sells more units, but some of those units would have sold anyway at full price and some come from a neighbouring product. Whether a promotion pays depends on how sensitive demand is to price and where the extra sales come from. A category manager needs to see that before setting next week's prices.
This planner shows it: change a price or add a discount, and see what happens to the product, its substitutes and the category's margin.
Data
Dunnhumby's The Complete Journey: two years of grocery purchases by 2,500 households, with prices paid, discounts, coupons and in-store displays and mailers. Only model outputs and aggregates are shown; the transactions themselves aren't redistributed.
How it works
- Weekly demand. Units and average price paid by product and store-week, for a handful of categories with enough price variation.
- Elasticities. A hierarchical Bayesian demand model, fitted with PyMC, estimates how units respond to a product's own price and to the prices of others in its category, with display and mailer activity controlled for. Products borrow strength from their category, so products with little price variation still get sensible estimates with honest uncertainty.
- Cannibalisation. Cross-price effects show which products lose sales when a neighbour is discounted.
- Optimisation. For each product, the price that maximises category margin under a stated cost assumption, with the uncertainty carried through.
Evaluation
Held-out weeks check the demand model's forecasts, and posterior predictive checks test whether the fitted model reproduces the price and promotion patterns in the data.
Demo
The planner a category manager would use: pick a product, move its price or add a discount, and see expected units, revenue and margin for the product, its substitutes and the whole category, each with a range. A table shows which discounts grow category margin and which only move sales between products.
Prices and promotions in the data were set by the retailer, not randomised, so the estimates rely on controls for promotion timing and remain observational.