Working example 01 Gamma–Gamma spend model

Profit that cannot be explained

“Revenue is growing, but we cannot see where the profit goes.”

A distributor with 500 business customers sees revenue rising but margin flat. Average order values and service costs vary widely, and many customers have ordered only once or twice.

How it works

The method in three steps

  1. Model spend honestlyEach order value is Gamma-distributed around a customer’s true mean; those means are themselves Gamma-distributed across customers.z ~ Gamma(p, ν), ν ~ Gamma(q, γ)
  2. Fit by maximum likelihoodThe parameters p, q and γ are fitted to every customer’s order count and average spend with a Nelder–Mead optimiser.E[M | x, m̄] = p(γ + x·m̄) / (p·x + q − 1)
  3. Attach cost-to-serveExpected margin is reduced by handling cost per order, returns and support contacts, then customers are ranked to build a cumulative profit curve.profit = x(E[M]·margin − c_order) − returns − contacts − account

Try it

The working example

Cost assumptions

Change the economics and the model re-ranks every customer.

Picking, packing and delivery
Fitted parameters–
Annual revenue–Synthetic customer book
Expected profit–
Customers losing money–
Hidden loss-makers–Look profitable on raw averages

Where the profit comes from — and where it goes

Customers ranked from most to least profitable. Everything after the peak destroys profit.

The profit pool

How gross margin is consumed by the cost of serving customers.

Shrinking unreliable averages

Customers with few orders are pulled towards the population mean.

Interpretation

From example to engagement

What the example shows

Profit leakage is rarely spread evenly. A minority of customers usually funds the rest, and the loss-makers are often small-basket, high-contact accounts whose revenue looks healthy. The Gamma–Gamma step stops a single large order from making an occasional customer look valuable.

With real data

  • Order lines, returns and service contacts from transactional systems.
  • Activity-based costs for handling, delivery and support.
  • Extensions: BG/NBD or Pareto/NBD models for purchase frequency and churn, giving forward-looking customer lifetime value.