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.

The business context

The problem and the solution

The business problem

Sales are rising, but the distributor is not keeping more profit. Some customers place small orders, return goods or need frequent support. Sales figures alone hide the cost of serving them.

How the solution helps

The solution compares customer spending with the cost of orders, returns and support. When a customer has placed very few orders, it tempers an unusually high or low average using evidence from the wider customer base. It then shows which accounts contribute profit and which may need different prices or service.

Explore the evidence

The input dataset

500 synthetic customer records covering one illustrative year. The table shows inputs, not estimated spending or profit. New customer sample replaces these records. The controls below set gross margin, handling cost and support cost; a return costs £9 and annual account overhead is £15.

All records are illustrative and generated in your browser. Browse every row using the table controls. Displayed decimals are rounded; calculations use full precision.

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.