A discrete distribution function is a staircase, so the inverse \(F^{-1}\) does not exist and a critical ratio almost never lands on a step. The marginal argument of the first session still runs, one unit at a time:
\[ \begin{aligned} c_u\,P\{X > Q\} &> c_o\,P\{X \le Q\} &&\text{the next unit is worth buying}\\ c_u\big(1 - F(Q)\big) &> c_o\,F(Q) &&P\{X > Q\} = 1 - F(Q)\\ F(Q) &< \frac{c_u}{c_u + c_o} &&\text{collect } F(Q)\\ Q^{*} &= \min\left\{Q : F(Q) \ge \frac{c_u}{c_u + c_o}\right\} &&\text{stop at the first failure} \end{aligned} \]
It is not an inverse. It is the smallest quantity whose cumulative probability reaches the ratio, and there \(F(Q^{*})\) is usually strictly greater. That gap is the staircase: a discrete newsvendor achieves a little better service than its costs call for, because it cannot buy a fraction of a unit.
The rule reads \(F(Q)\), and pricing the answer needs the expected shortage \(G^{1}(Q) = E[(X - Q)^{+}]\). A worksheet supplies both. Before we let one, we build the columns by hand, a row at a time:
\[ \begin{aligned} g(x) &= g(x-1)\,\frac{\lambda}{x}, \qquad g(0) = e^{-\lambda} &&\text{each Poisson mass from the one before}\\ F(x) &= F(x-1) + g(x) &&\text{a running sum}\\ G^{0}(x) &= 1 - F(x) &&P\{X > x\}\\ G^{1}(x) &= G^{1}(x-1) - G^{0}(x-1), \qquad G^{1}(0) = E[X] &&\text{the } x\text{th unit removes a shortage when } X > x - 1 \end{aligned} \]
Only the first line is special to the Poisson: dividing \(g(x)\) by \(g(x-1)\) cancels everything except \(\lambda/x\), so no factorial is ever computed. A different family changes how \(g\) is obtained and leaves the other three lines alone.
The fourth line has a plain reading. Raising the stock from \(x - 1\) to \(x\) adds one unit, and that unit is used only when demand is at least \(x\), which has probability \(G^{0}(x-1)\). Against a stock of zero every unit demanded is short, so the column starts at the mean.
Poisson demand with \(\lambda = 6\). Each row uses the row above it.
| \(x\) | \(g(x)\) | \(F(x)\) | \(G^{0}(x)\) | \(G^{1}(x)\) | What happened |
|---|---|---|---|---|---|
| 0 | 0.0025 | 0.0025 | 0.9975 | 6.0000 | \(g(0) = e^{-6} = 0.002479\); \(G^{1}\) starts at the mean |
| 1 | 0.0149 | 0.0174 | 0.9826 | 5.0025 | \(0.002479(6/1)\); \(\;6.0000 - 0.9975\) |
| 2 | 0.0446 | 0.0620 | 0.9380 | 4.0198 | \(0.014873(6/2)\); \(\;5.0025 - 0.9826\) |
| 3 | 0.0892 | 0.1512 | 0.8488 | 3.0818 | \(0.044618(6/3)\); \(\;4.0198 - 0.9380\) |
| 4 | 0.1339 | 0.2851 | 0.7149 | 2.2330 | the same four steps |
| 5 | 0.1606 | 0.4457 | 0.5543 | 1.5181 | |
| 6 | 0.1606 | 0.6063 | 0.3937 | 0.9637 | |
| 7 | 0.1377 | 0.7440 | 0.2560 | 0.5700 | |
| 8 | 0.1033 | 0.8472 | 0.1528 | 0.3140 |
The check. With one unit stocked, it is left over only when nothing is demanded: \(1 \times g(0) = 0.0025\). The leftover identity gives the same, \(G^{1}(1) + 1 - E[X] = 5.0025 + 1 - 6 = 0.0025\).
The utility storeroom’s pad-mount transformer, $3,800. A capital project will change the specification, so transformers not used become obsolete. Failures over the project window: Poisson with \(\lambda = 6\).
\[ \begin{aligned} c_o &= 3800 - 900 = \$2{,}900 &&\text{bought and unused, scrapped at \$900}\\ c_u &= 9500 - 3800 = \$5{,}700 &&\text{a failure covered by an emergency purchase}\\ \frac{c_u}{c_u + c_o} &= \frac{5700}{8600} = 0.662791 &&\text{critical ratio} \end{aligned} \]
| \(Q\) | \(F(Q)\) | Expected shortage \(G^{1}(Q)\) | Expected cost | Against 0.6628 |
|---|---|---|---|---|
| 4 | 0.2851 | 2.2330 | $13,404 | short, add one |
| 5 | 0.4457 | 1.5181 | $10,155 | short, add one |
| 6 | 0.6063 | 0.9637 | $8,288 | short, add one |
| 7 | 0.7440 | 0.5700 | $7,802 | clears it: stop |
| 8 | 0.8472 | 0.3140 | $8,501 | the check: cost rises |
Treat demand as normal with mean 6 and variance 6: \(6 + \Phi^{-1}(0.6628)\sqrt{6} = 6 + 0.4201(2.4495) = 7.029\), which rounds to 7. It agrees.
Now change one number: the emergency purchase costs $8,150, so \(c_u = \$4{,}350\) and the ratio is exactly 0.6000. What do the exact rule and the normal say?
| Reads | Answer | |
|---|---|---|
| Exact rule | \(F(5) = 0.4457\), \(F(6) = 0.6063\) | 6 |
| Normal approximation | \(6 + 0.2533(2.4495) = 6.621\) | 7 |
The approximation buys one transformer too many, $3,800, a real error on a real decision.
When the approximation is safe
When one unit is a small fraction of the standard deviation. At \(\lambda = 6\) one transformer is \(1/2.45 = 40\%\) of it, and rounding decides the answer; at \(\lambda = 600\) it is 4%. Use the staircase rule whenever the numbers are small, which is when items are slow-moving and each unit is expensive.
Four extensions cover most of what a real single-period problem adds. None changes the critical ratio’s form; they change what goes into it.
\(c_u = s - c\) is the whole underage cost only if a customer turned away returns next time as though nothing happened. Let \(\pi\) represent the stockout penalty per unit of unmet demand, so \(c_u = s - c + \pi\).
For the belt, suppose a refused dealer costs $40 in future business:
\[ \begin{aligned} c_u &= 45 + 40 = 85, \qquad \frac{85}{85 + 38} = 0.6911 &&\text{from } 0.5422\\ Q^{*} &= 465.37 + 0.4988(92.64) = 511.58 \to \textbf{512 belts} &&\text{from 475} \end{aligned} \]
A penalty under half the selling price moved the order by 37 belts, 7.8%.
\(\pi\) is the parameter no ledger contains. Report the decision as: 475 belts if a stockout costs only the margin, 512 if it costs $40 more, and the organization should say which it believes.
With \(I\) belts already held, the model determines the quantity that should be available: the order-up-to level \(S^{*}\). The cost of ending with \(S - X\) units does not care how they got there:
\[ S^{*} = F^{-1}\!\left(\frac{c_u}{c_u + c_o}\right), \qquad Q^{*} = \left(S^{*} - I\right)^{+} \]
| Already on hand | \(S^{*}\) | Order |
|---|---|---|
| 0 | 475.18 | 475 |
| 120 | 475.18 | \(475.18 - 120 = 355.18 \to\) 355 |
| 600 | 475.18 | 0: over-stocked before it begins |
The truncation at zero matters: a newsvendor cannot sell stock back.
This is the first appearance of a structure the rest of the book uses constantly: chapter 9’s order-up-to policies are this idea with a trigger attached.
If \(c_u \le 0\) the ratio is zero or negative: order nothing. Correct, and usually a mis-stated problem: an item nobody loses by running out of is one nobody should stock.
If \(c_o \le 0\), salvage at least the purchase cost, the ratio is one or more: order without limit. Also correct, and also a sign of a mis-statement: a unit that can always be disposed of for what it cost carries no risk. Find the cost you left out.
The strongest assumption is in the title: leftover stock has no value after the period. Exactly true for a newspaper, a flu vaccine, the belt’s final buy. False for most inventory, where a leftover is available next week.
The test
What is a leftover unit worth at the end of the period? Its scrap value: a newsvendor problem. Nearly what you paid: a multi-period problem, which the end of today’s session shows is a newsvendor again, with a different \(c_o\).
The first simulation in the book. The closed form already gives the belt’s exact answer, so simulating it proves nothing about the belt. It proves the simulation is right, which is worth having before pointing it where no formula exists.
val demand = NegativeBinomialRV(probOfSuccess = 0.054222, numSuccess = 26.6798, streamNum = 1)
val stat = Statistic("profit at Q")
demand.resetStartStream()
repeat(100_000) {
val d = demand.value
stat.collect(s * minOf(d, q) + u * maxOf(0.0, q - d) - c * q)
}
println("%.2f +/- %.2f".format(stat.average, stat.halfWidth))The model is the profit expression on sampled demand, from the fitted negative binomial, not the normal approximation: the simulation samples counts as easily as real numbers. resetStartStream before each candidate makes every quantity face the same hundred thousand demands, so rows compare with each other, and each row is reproducible on its own.
| \(Q\) | 440 | 460 | 469 | 490 | 510 |
|---|---|---|---|---|---|
| Estimated profit | $17,737.18 | $17,877.57 | $17,893.03 | $17,818.04 | $17,610.98 |
| Half-width | $21.02 | $24.68 | $26.31 | $29.95 | $33.15 |
| Closed form | $17,732.96 | $17,871.00 | $17,886.06 | $17,811.30 | $17,606.01 |
At \(Q^{*} = 469\) the interval is \([\$17{,}866.72, \$17{,}919.34]\), and the exact $17,886.06 lies inside it, as it does in every column. Five agreements are more convincing than one, and cost nothing extra. The simulation peaks at the same candidate, which the common demands make a fair comparison.
What it has that the formula does not: every figure carries a half-width. A simulated answer without its interval is a number that is not there.
What it costs: the half-width shrinks with the square root of the replications, so ten times the precision costs a hundred times the run. Simulation is not how you solve the newsvendor.
Simulation earns its place the moment an assumption behind the critical ratio fails. Four failures are common:
In all four the policy stays simple, one quantity chosen once, and what changes is the cost function. A cost function is easier to sample than to integrate.
Review at the start of every period; an order arrives before the period’s demand; unmet demand is backordered. Let \(x\) be the position before ordering and \(y\) the position after, the order-up-to level. The period’s expected holding and backorder cost is
\[ L(y) = h\,E\left[(y - D)^{+}\right] + b\,E\left[(D - y)^{+}\right], \]
a newsvendor cost with \(c_o = h\) and \(c_u = b\). What couples the periods is that \(y - D\) is next period’s \(x\):
\[ V_t(x) = \min_{y \ge x}\left\{c(y - x) + L(y) + \alpha\,E\left[V_{t+1}(y - D)\right]\right\} \]
Suppose the level \(S\) is the same every period and the position starts at or below it. Demand never runs negative, so the position after any period is again at or below \(S\), and the next review can always order back up to \(S\).
Nothing this period does constrains what the next can reach, so each period solves its own problem. Every unit bought is eventually sold, so \(c\) cancels, and what remains is \(L(y)\):
\[ F(S^{*}) = \frac{b}{b + h} \]
A base-stock policy, and myopic: the level best for one period is best for all of them.
Before the deck was withdrawn the belt sold every week, negative binomial with mean 33.24 a week. A belt short is a $45 margin lost; a belt left over is sold next week and costs \(h = \$1.00\) a month to carry. What level should each week start with?
\[ h = \$1.00\ \frac{\text{per belt}}{\text{month}} \times \frac{12\ \text{months}}{52\ \text{weeks}} = \$0.2308, \qquad \frac{c_u}{c_u + c_o} = \frac{45}{45 + 0.2308} = 0.99490 \]
\(F(128) = 0.99487\) falls short and \(F(129) = 0.99512\) reaches it, so \(S^{*} = 129\): nearly four weeks of mean demand.
| If … | Use | Sheet | Code |
|---|---|---|---|
| a leftover unit is worth nearly what it cost | Multi-period base stock, \(c_o = h\) | none | none |
| the salvage rule is not linear, or items interact | Simulation | none | estimate |
| demand is a count with a small mean | Discrete rule | Discrete |
solve |
| demand is large enough to treat as continuous | Critical ratio quantile | Newsvendor |
solve |
Read from the top and stop at the first row that fits. Notice that the first row is a test, not a method: it decides whether the newsvendor applies at all.
The final buy passes step 1, because the deck is withdrawn; fitted as a negative binomial it solves exactly at 469 belts.
The staircase rule: the smallest \(Q\) whose cumulative probability reaches the ratio. For the transformers, 7, confirmed by the cost column.
Rounding the normal answer fails when one unit is a large fraction of \(\sigma\): at a ratio of 0.6, it buys one $3,800 transformer too many.
Extensions change what goes into the ratio: a $40 penalty moves the belt to 512; stock on hand gives an order-up-to level.
The single-period test: what is a leftover worth at the end of the period?
Simulation agreed with the closed form at all five quantities, and is worth its cost only where the formula breaks.
The multi-period problem has a newsvendor inside it: a base-stock level at \(b/(b + h)\), myopic, and for the belt in an ordinary week, 129.
Read before next session: Building These Models in a Worksheet and Using the Software.
Today’s material was Discrete Demand, Extensions, Estimating the Answer by Simulation, From One Period to Many and Choosing and Applying a Model.
Next session:
Bring the two-tier scrap dealer. The code prices it.