Inventory and supply chain / Single-period inventory

Newsvendor model

Choose one order quantity before uncertain demand is known, when every unit short and every unit left over has a cost. The answer is a quantile of demand, set by the ratio of the two costs.

Full guide Beginner Interactive: Critical Ratio Explorer →

What problem does this solve?

You must commit to a quantity before you know demand, and you cannot correct it afterwards. Order too many and the leftovers lose value. Order too few and you lose the sales you could have made. The newsvendor model finds the quantity that maximizes expected profit, or equivalently minimizes the expected cost of being wrong, given a probability distribution for demand.

The name comes from a newspaper seller buying papers each morning, but the structure is everywhere: seasonal fashion buys, fresh food, event merchandise, print runs, a capacity reservation, a staffing level for a single shift, a one-time production batch.

When should you use it?

Use it when all of these hold, at least approximately:

  • One decision, one period. You choose a quantity once, then demand happens.
  • Leftovers lose value, or the next opportunity to use them is far enough away that carrying them has a real cost.
  • Costs are roughly linear in the size of the mistake: each extra unit short or over costs about the same.
  • You have a demand distribution, not just a point forecast.

When leftover stock carries to the next period, the same logic still applies per period, with the holding cost as the overage cost; see critical ratio. When there is a fixed ordering cost, a minimum order, or a lead time spanning several periods, the newsvendor becomes one building block of a richer policy.

Mathematical formulation

Let DD be random demand with cumulative distribution FF, and QQ the order quantity. Write

  • cuc_u: the underage cost, per unit of unmet demand (typically price minus cost, plus any penalty),
  • coc_o: the overage cost, per leftover unit (typically cost minus salvage value).

The expected cost of ordering QQ is

G(Q)  =  co E[(Q−D)+]  +  cu E[(D−Q)+],G(Q) \;=\; c_o\,\mathbb{E}\big[(Q - D)^+\big] \;+\; c_u\,\mathbb{E}\big[(D - Q)^+\big],

where x+=max⁡(x,0)x^+ = \max(x, 0). GG is convex, and its derivative is G′(Q)=coF(Q)−cu (1−F(Q))G'(Q) = c_o F(Q) - c_u\,(1 - F(Q)). Setting it to zero gives the optimality condition

F(Q∗)  =  cucu+co.F(Q^*) \;=\; \frac{c_u}{c_u + c_o}.

So Q∗=F−1 ⁣(cu/(cu+co))Q^* = F^{-1}\!\big(c_u / (c_u + c_o)\big): the optimal order is the critical-ratio quantile of demand. For normal demand N(μ,σ2)N(\mu, \sigma^2) this is Q∗=μ+zσQ^* = \mu + z\sigma with z=Φ−1(CR)z = \Phi^{-1}(\text{CR}). For discrete demand, Q∗Q^* is the smallest integer with F(Q∗)≥CRF(Q^*) \ge \text{CR}.

Maximizing expected profit gives the same answer. With price pp, unit cost cc, and salvage vv, expected profit is p E[min⁡(D,Q)]−cQ+v E[(Q−D)+]p\,\mathbb{E}[\min(D, Q)] - cQ + v\,\mathbb{E}[(Q - D)^+], which differs from −G(Q)-G(Q) only by a constant. Here cu=p−cc_u = p - c and co=c−vc_o = c - v.

Intuition

Build the order one unit at a time. The next unit is sold with probability 1−F(Q)1 - F(Q), earning cuc_u you would otherwise lose. It is left over with probability F(Q)F(Q), costing coc_o. Keep adding units while

cu (1−F(Q))  >  co F(Q),c_u\,\big(1 - F(Q)\big) \;>\; c_o\,F(Q),

and stop when the two sides are equal. Three consequences follow.

  1. Only the ratio of the costs matters. Doubling both costs changes nothing.
  2. The service level is an output. The probability of no stockout at Q∗Q^* equals the critical ratio exactly. A 95% target is right only when a shortage costs 19 times a leftover.
  3. Uncertainty is priced, not padded. When cu>coc_u > c_o the optimum sits above the median and moves further up as demand gets noisier. When co>cuc_o > c_u it sits below the median and moves further down.

The explainer on order economics shows these effects visually.

Worked example

A retailer buys a seasonal item at c = \8,sellsitat, sells it at p = $20,andclearsleftoversat, and clears leftovers at v = $4$. Demand is forecast as normal with mean 500 and standard deviation 80.

  • Underage cost: cu=20−8=12c_u = 20 - 8 = 12. Overage cost: co=8−4=4c_o = 8 - 4 = 4.
  • Critical ratio: 12/(12+4)=0.7512 / (12 + 4) = 0.75, so z=Φ−1(0.75)=0.674z = \Phi^{-1}(0.75) = 0.674.
  • Optimal order: Q∗=500+0.674×80≈554Q^* = 500 + 0.674 \times 80 \approx 554.
Order QQP(no stockout)Fill rateExpected units shortExpected leftoverExpected profit
500 (the mean)50.0%93.6%31.931.9$5,489
554 (optimal)75.0%97.6%11.965.9$5,593
60089.4%99.2%4.1104.1$5,535
65097.0%99.8%0.9150.9$5,385

Ordering the mean leaves about $104 of expected profit on the table. Chasing a 97% in-stock rate costs about $208. With perfect knowledge of demand, profit would be $6,000; the $407 gap at the optimum is the cost of uncertainty, which only a better forecast can reduce.

Python implementation

import numpy as np
from scipy.stats import norm

def newsvendor(cu, co, ppf):
    """Optimal order quantity for any demand distribution with a quantile function."""
    if cu < 0 or co < 0 or cu + co == 0:
        raise ValueError("costs must be non-negative and not both zero")
    cr = cu / (cu + co)
    return max(0.0, ppf(cr)), cr

price, cost, salvage = 20.0, 8.0, 4.0
cu, co = price - cost, cost - salvage

q_star, cr = newsvendor(cu, co, lambda p: norm.ppf(p, loc=500, scale=80))
print(f"CR = {cr:.2f}, Q* = {q_star:.1f}")          # CR = 0.75, Q* = 554.0

# Check by simulation, which also works for forecasts given as samples.
rng = np.random.default_rng(0)
demand = rng.normal(500, 80, size=200_000)

def expected_profit(q, d=demand):
    sold = np.minimum(d, q)
    left = np.maximum(q - d, 0)
    return (price * sold - cost * q + salvage * left).mean()

grid = np.arange(450, 651)
best = grid[np.argmax([expected_profit(q) for q in grid])]
print(best)                                         # ~554

# From forecast samples directly: the CR-quantile of the samples.
print(np.quantile(demand, cr))                      # ~554

The last line is the practical form: if your forecast produces samples (from a probabilistic model, a simulation, or bootstrapped history), the optimal order is simply their critical-ratio quantile.

Interactive demonstration

The Critical Ratio Explorer lets you set cuc_u and coc_o (or derive them from price, cost, and salvage), choose normal, lognormal, or Poisson demand, and see the demand distribution, the expected cost curve, and the optimal order update together.

Computational complexity and trade-offs

  • Closed form: one quantile evaluation, O(1)O(1) for standard distributions.
  • Discrete demand: a search over the CDF, O(log⁡n)O(\log n) with binary search on a tabulated CDF.
  • Sample-based forecasts: a quantile of nn samples, O(n)O(n) with selection or O(nlog⁡n)O(n \log n) with sorting. Sampling error in the quantile shrinks as 1/n1/\sqrt{n} and is largest for extreme ratios, so very high or very low critical ratios need more samples.
  • Many items with a shared budget or capacity: the items couple, and the problem becomes a constrained (often convex) optimization; a Lagrange multiplier on the budget turns it back into per-item newsvendors with adjusted costs.

Common mistakes

  • Ordering the forecast. The mean is optimal only when cu=coc_u = c_o and demand is symmetric.
  • Misstating the overage cost. For goods that carry over, the overage cost is holding cost, not the purchase price.
  • Leaving goodwill out of the underage cost. If a stockout loses future business, the true cuc_u is larger than the lost margin.
  • Trusting a normal model for skewed or small demand. The normal can put probability on negative demand. Use a lognormal, gamma, or negative binomial, or work from samples.
  • Fixing the service level instead of pricing the costs. A uniform in-stock target over-orders some items and under-orders others.
  • Ignoring forecast error in the distribution. The variance you use should be the variance of the forecast error, not the historical variance of demand.