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 be random demand with cumulative distribution , and the order quantity. Write
- : the underage cost, per unit of unmet demand (typically price minus cost, plus any penalty),
- : the overage cost, per leftover unit (typically cost minus salvage value).
The expected cost of ordering is
where . is convex, and its derivative is . Setting it to zero gives the optimality condition
So : the optimal order is the critical-ratio quantile of demand. For normal demand this is with . For discrete demand, is the smallest integer with .
Maximizing expected profit gives the same answer. With price , unit cost , and salvage , expected profit is , which differs from only by a constant. Here and .
Intuition
Build the order one unit at a time. The next unit is sold with probability , earning you would otherwise lose. It is left over with probability , costing . Keep adding units while
and stop when the two sides are equal. Three consequences follow.
- Only the ratio of the costs matters. Doubling both costs changes nothing.
- The service level is an output. The probability of no stockout at equals the critical ratio exactly. A 95% target is right only when a shortage costs 19 times a leftover.
- Uncertainty is priced, not padded. When the optimum sits above the median and moves further up as demand gets noisier. When 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 = \8p = $20v = $4$. Demand is forecast as normal with mean 500 and standard deviation 80.
- Underage cost: . Overage cost: .
- Critical ratio: , so .
- Optimal order: .
| Order | P(no stockout) | Fill rate | Expected units short | Expected leftover | Expected profit |
|---|---|---|---|---|---|
| 500 (the mean) | 50.0% | 93.6% | 31.9 | 31.9 | $5,489 |
| 554 (optimal) | 75.0% | 97.6% | 11.9 | 65.9 | $5,593 |
| 600 | 89.4% | 99.2% | 4.1 | 104.1 | $5,535 |
| 650 | 97.0% | 99.8% | 0.9 | 150.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 and (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, for standard distributions.
- Discrete demand: a search over the CDF, with binary search on a tabulated CDF.
- Sample-based forecasts: a quantile of samples, with selection or with sorting. Sampling error in the quantile shrinks as 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 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 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.
Related patterns
Critical ratio
The ratio of what a shortage costs to the total cost of both mistakes. It tells you which percentile of demand to stock to, and it is why the right service level differs from SKU to SKU.
Economic order quantity
Find the order quantity that minimizes the trade-off between ordering cost and holding cost under steady, known demand.
Safety stock
Buffer stock against demand and lead-time uncertainty, sized by economics rather than habit.
Chance Constraints
Require a constraint to hold with at least a target probability, rather than always — a way to bake in a service-level target directly.
Two-Stage Stochastic Programming
Make a decision now, observe uncertainty, then make a follow-up decision — optimizing the first-stage choice against the expected cost of every possible second-stage outcome.
Stochastic inventory optimization
Multi-period inventory decisions under uncertain demand and lead time.