What does Solar Terms, Thermal Lag and Seasonal Demand conclude, in numbers, about “The Price of a Phase Error: Order Timing under the Newsvendor Model”?

Answer: Chapter 6 prices the error with the newsvendor model: ordering by the term names earns only 0.7196 of the best profit, less than flat ordering that ignores the season (0.7530), while the phase drift from climate change costs only 0.00147.

Scope of the numbers: Parameters in this book are illustrative; all calculations are generated by the book's programs; the book is non-personalised business guidance, and its order dates are demonstrations that promise no sales to any merchant. Chapter 4 shows that "the hottest day" is a statistic dominated by weather noise: in illustrative data the single hottest day misses by 16.81 days, while the harmonic phase from three years of daily data misses by only 1.25 days.

中文版

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: 0.7196, 0.7530

critical fractile 0.5714, z = 0.1800
assumed lagerrorseason profitshare of bestfill rate
0.0-32.541,6940.71960.7766
10.0-22.547,9230.82710.8351
20.0-12.553,9810.93170.8880
27.5-5.057,2180.98760.9152
32.5+0.057,9381.00000.9212
37.5+5.057,2200.98760.9150
44.0+11.554,5450.94140.8919
55.0+22.548,1310.83070.8344
no season at all (flat plan): 43,626, share 0.7530, fill 0.8042
Show the full program
# Chapter 6. p61: what a phase error costs a weekly newsvendor
# ILLUSTRATIVE perishable seasonal line (same demand curve as p52:
# 30 + 12.0 E[max(0, T - 18)] units a day, true lag 32.5 days, 26
# weeks from d = -60 after Xiazhi). Weekly demand is normal with mean
# mu and sd 0.25 mu. Price 10, unit cost 6, salvage 3 (made-up), so
# the critical fractile is (10 - 6) / (10 - 3). Each week the buyer
# orders Q = m + z s where m is the forecast under an assumed lag l
# and s = 0.25 m (the newsvendor rule of Arrow, Harris and Marschak
# 1951, see also B-211). Expected sales mu - sigma L(z) with the
# normal loss L(z) = phi(z) - z (1 - Phi(z)); no stock carries over.
import math

YEAR = 365.2422
W = 2 * math.pi / YEAR
PRICE, COST, SALVAGE = 10.0, 6.0, 3.0
CV = 0.25
TRUE_LAG = 32.5


def phi(z):
    return math.exp(-0.5 * z * z) / math.sqrt(2 * math.pi)


def cdf(z):
    return 0.5 * (1 + math.erf(z / math.sqrt(2)))


def inv_cdf(p):
    lo, hi = -10.0, 10.0
    for _ in range(200):
        mid = (lo + hi) / 2
        if cdf(mid) < p:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2


def pos_part(mu, s):
    return mu * cdf(mu / s) + s * phi(mu / s)


def weekly(lag, first=-60, weeks=26):
    out = []
    for w in range(weeks):
        days = []
        for i in range(7):
            d = first + 7 * w + i
            m = 14.0 + 14.0 * math.cos(W * (d - lag))
            days.append(30 + 12.0 * pos_part(m - 18, 3.0))
        out.append(math.fsum(days))
    return out


Z = inv_cdf((PRICE - COST) / (PRICE - SALVAGE))


def week_profit(q, mu):
    sigma = CV * mu
    z = (q - mu) / sigma
    sold = mu - sigma * (phi(z) - z * (1 - cdf(z)))
    return PRICE * sold + SALVAGE * (q - sold) - COST * q, sold


def season(plan, truth):
    prof, sold = [], []
    for m, mu in zip(plan, truth):
        p, s = week_profit(m * (1 + Z * CV), mu)
        prof.append(p)
        sold.append(s)
    return math.fsum(prof), math.fsum(sold)


if __name__ == "__main__":
    truth = weekly(TRUE_LAG)
    demand = math.fsum(truth)
    best, _ = season(truth, truth)
    print("critical fractile {:.4f}, z = {:.4f}".format(
        (PRICE - COST) / (PRICE - SALVAGE), Z))
    print("assumed lag  error  season profit  share of best  fill rate")
    for lag in (0.0, 10.0, 20.0, 27.5, 32.5, 37.5, 44.0, 55.0):
        p, s = season(weekly(lag), truth)
        print("{:11.1f}  {:+5.1f}  {:13,.0f}  {:13.4f}  {:9.4f}".format(
            lag, lag - TRUE_LAG, p, p / best, s / demand))
    flat, s = season([demand / 26] * 26, truth)
    print("no season at all (flat plan): {:,.0f}, share {:.4f}, fill {:.4f}"
          .format(flat, flat / best, s / demand))

Single source and citation

Fan, Y. (2026). Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting (Version 1.0.0), Chapter 6: The Price of a Phase Error: Order Timing under the Newsvendor Model. 5D Library. DOI pending

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

BibTeX
@book{fan2026232,
  author    = {Fan, Yafu},
  title     = {Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book