What does Critical Fractiles for Pre-Season Buying conclude, in numbers, about “Dirichlet-Multinomial Priors for the Size Curve: Weighing Head-Office Experience Against the Store's Own Sample”?

Answer: The result is a sobering reminder. With 12 stores and 720 units in all, the estimate is 139.0, the band starts at 49.6 and has no upper end: the data can rule out a weak prior but cannot say how strong the prior is. The log-likelihood differences tell the same story. A strength of 10 is 16.922 log units worse than 40 and can be excluded, while a strength of 160 is actually 3.036 better than 40 and cannot be told apart. With 48 stores the estimate is 56.1 and the band runs from 39.0 to 85.9; only with 192 stores does the band, from 37.1 to 52.1 around an estimate of 43.9, pin the true value down firmly.

Scope of the numbers: Its goods, stores and demand parameters are illustrative; all calculations are generated by its programs; the book is not individual business advice. Chapter 1 derives the critical fractile from marginal arithmetic; under illustrative parameters the optimal order equals the mean only at a margin of exactly 0.3750, and ordering the mean for an eight-tenths-margin item loses 6.96 % of expected profit.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 10, 12, 139.0, 160, 192, 3.036

stores units EB A095% profile band ll10-ll40 ll160-ll40
12720 139.0 49.6 to open -16.922 3.036
482880 56.1 39.0 to 85.9 -50.707 -7.198
192 1152043.9 37.1 to 52.1 -168.756 -63.573
true A040; band = A0 with log-lik within 1.92 of max
Show the full program
# Chapter 3. p32: Estimating the prior strength A0 by empirical Bayes.
# Synthetic stores: each store's true curve ~ Dirichlet(40 b),
# each sells 60 units, counts multinomial. For a grid of A0 we compute
# the Dirichlet-multinomial log marginal likelihood
#   sum_s [lgG(A0) - lgG(A0 + N_s) + sum_k (lgG(A0 b_k + n_sk)
#          - lgG(A0 b_k))]
# with b the pooled share; golden search for the maximiser and a
# profile band. True A0 = 40 is hidden from the estimator. Fixed seed.
import math
import random

rng = random.Random(20261112)
BASE = (0.08, 0.22, 0.34, 0.24, 0.12)
TRUE_A0, PER = 40.0, 60
lg = math.lgamma


def dirichlet(alpha):
    g = [rng.gammavariate(a, 1.0) for a in alpha]
    s = math.fsum(g)
    return [x / s for x in g]


def multinomial(p, n):
    c = [0] * len(p)
    for _ in range(n):
        u, acc = rng.random(), 0.0
        for k, pk in enumerate(p):
            acc += pk
            if u < acc or k == len(p) - 1:
                c[k] += 1
                break
    return c


def fit(stores):
    data = [multinomial(dirichlet([TRUE_A0 * x for x in BASE]), PER)
            for _ in range(stores)]
    tot = [math.fsum(s[k] for s in data) for k in range(len(BASE))]
    grand = math.fsum(tot)
    b = [t / grand for t in tot]

    def loglik(a0):
        parts = []
        for s in data:
            parts.append(lg(a0) - lg(a0 + math.fsum(s)))
            for k, nk in enumerate(s):
                parts.append(lg(a0 * b[k] + nk) - lg(a0 * b[k]))
        return math.fsum(parts)

    lo, hi = math.log(2.0), math.log(5000.0)
    r = (math.sqrt(5.0) - 1.0) / 2.0
    for _ in range(80):
        x1, x2 = hi - r * (hi - lo), lo + r * (hi - lo)
        if loglik(math.exp(x1)) > loglik(math.exp(x2)):
            hi = x2
        else:
            lo = x1
    best = loglik(math.exp(lo))
    grid = [math.exp(math.log(2.0) + i * 0.01) for i in range(800)]
    inside = [a for a in grid if loglik(a) >= best - 1.92]
    return math.exp(lo), inside[0], inside[-1], [loglik(a) for a in
                                                 (10.0, 40.0, 160.0)]


print("stores units  EB A0   95% profile band    ll10-ll40  ll160-ll40")
for stores in (12, 48, 192):
    a0, lo, hi, ll = fit(stores)
    top = "{:7.1f}".format(hi) if hi < 5000.0 else "   open"
    print("{:6d} {:5d}  {:6.1f}  {:6.1f} to {}  {:10.3f}  {:10.3f}"
          .format(stores, stores * PER, a0, lo, top, ll[0] - ll[1],
                  ll[2] - ll[1]))
print("true A0 = {:.0f}; band = A0 with log-lik within 1.92 of max"
      .format(TRUE_A0))

Single source and citation

Fan, Y. (2026). Newsvendor Critical Fractiles for Pre-Season Buying, Dirichlet Size-Curve Priors and Dynamic-Programming End-of-Season Markdowns (Version 1.0.0), Chapter 3: Dirichlet-Multinomial Priors for the Size Curve: Weighing Head-Office Experience Against the Store's Own Sample. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-211 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026211,
  author    = {Fan, Yafu},
  title     = {Newsvendor Critical Fractiles for Pre-Season Buying, Dirichlet Size-Curve Priors and Dynamic-Programming End-of-Season Markdowns},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book