What does Bistability, Lipolysis and Menu Math conclude, in numbers, about “Two Cheap Measurements”?

Answer: On one synthetic sample the waist ratio reaches an area of 0.9244 and the index 0.9645, so the blood test adds 0.0400. A two-step rule scores 0.7858 against 0.7970 for the index alone while ordering blood on a minority. The best index cutoff, 8.705, sits where the validation literature puts it. Chapter 5 turns from measuring people to feeding them, starting with the mineral the low-carbohydrate week takes away.

Scope of the numbers: Its parameters are illustrative or synthetic; the samples of Chapter 4 are generated; all figures are produced by the programs printed in the book; the book is not medical advice and does not diagnose. Chapter 4 reaches an area of 0.9645 for the index against 0.9244 for the waist ratio on the same synthetic sample, so the blood test adds 0.0400, with a best index cutoff of 8.705.

中文版

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.0400, 0.7858, 0.7970, 0.9244, 0.9645, 8.705

   mean index: resistant 9.1594, sensitive 8.3078
   area under the curve: 0.9645
   best cutoff 8.705: sensitivity 0.9165, specificity 0.8812
   cutoff   sensitivity   specificity   sum minus one
   8.300    0.9958        0.4883        0.4840
   8.500    0.9770        0.7183        0.6953
   8.600    0.9525        0.8115        0.7640
   8.700    0.9190        0.8780        0.7970
   8.800    0.8558        0.9290        0.7848
   9.000    0.6785        0.9825        0.6610
   waist-to-height ratio on the same people: area 0.9244
   two-step rule, waist ratio at or above 0.52 and then the index:
   sensitivity 0.8423, specificity 0.9435, sum minus one 0.7858
   so the blood test adds 0.0400 to the waist measurement alone
Show the full program
# Chapter 4. p08: The triglyceride-glucose index on the same synthetic
# sample as p07. The index is the natural logarithm of fasting
# triglycerides times fasting glucose divided by two, with both in
# mg/dL, so it is the sum of the two logarithms less the logarithm of
# two. The generator, seed and draw order are identical to p07, so the
# two programs see the same people. Reported: the area under the curve,
# the best cutoff, and what a two-step rule gains over either marker.
import math
import random

SEED, N = 95, 4000
WHTR0, WHTR_G, WHTR_SD = 0.485, 0.100, 0.050
TG0, TG_G, TG_SD = 90.0, 175.0, 0.30
FPG0, FPG_G, FPG_SD = 90.0, 108.0, 0.08
LAT = 0.6

def sample():
    rng = random.Random(SEED)
    rows = []
    for g in (0, 1):
        for _ in range(N):
            z = rng.gauss(0.0, 1.0)
            ew = rng.gauss(0.0, 1.0)
            et = rng.gauss(0.0, 1.0)
            ef = rng.gauss(0.0, 1.0)
            mix = LAT * z + (1.0 - LAT ** 2) ** 0.5 * ew
            whtr = WHTR0 + WHTR_G * g + WHTR_SD * mix
            ltg = (math.log(TG0) + math.log(TG_G / TG0) * g
                   + TG_SD * (LAT * z + (1.0 - LAT ** 2) ** 0.5 * et))
            lfpg = (math.log(FPG0) + math.log(FPG_G / FPG0) * g
                    + FPG_SD * (LAT * z + (1.0 - LAT ** 2) ** 0.5 * ef))
            rows.append((g, whtr, ltg + lfpg - math.log(2.0)))
    return rows

def auc(pos, neg):
    both = sorted([(v, 1) for v in pos] + [(v, 0) for v in neg])
    ranks, i = [0.0] * len(both), 0
    while i < len(both):
        j = i
        while j + 1 < len(both) and both[j + 1][0] == both[i][0]:
            j += 1
        r = (i + j) / 2.0 + 1.0
        for k in range(i, j + 1):
            ranks[k] = r
        i = j + 1
    s = sum(r for r, (_, lab) in zip(ranks, both) if lab == 1)
    n1, n0 = len(pos), len(neg)
    return (s - n1 * (n1 + 1) / 2.0) / (n1 * n0)

def point(pos, neg, cut):
    sens = sum(1 for v in pos if v >= cut) / len(pos)
    spec = sum(1 for v in neg if v < cut) / len(neg)
    return sens, spec

if __name__ == "__main__":
    rows = sample()
    pos = [t for g, _, t in rows if g == 1]
    neg = [t for g, _, t in rows if g == 0]
    print("   mean index: resistant {:.4f}, sensitive {:.4f}"
          .format(sum(pos) / len(pos), sum(neg) / len(neg)))
    print("   area under the curve: {:.4f}".format(auc(pos, neg)))
    best, best_cut = -1.0, 0.0
    for i in range(3001):
        cut = 7.00 + 0.001 * i
        sens, spec = point(pos, neg, cut)
        if sens + spec - 1.0 > best:
            best, best_cut = sens + spec - 1.0, cut
    sens, spec = point(pos, neg, best_cut)
    print("   best cutoff {:.3f}: sensitivity {:.4f}, specificity {:.4f}"
          .format(best_cut, sens, spec))
    print("   cutoff   sensitivity   specificity   sum minus one")
    for cut in (8.300, 8.500, 8.600, 8.700, 8.800, 9.000):
        sens, spec = point(pos, neg, cut)
        print("   {:<9.3f}{:<14.4f}{:<14.4f}{:.4f}"
              .format(cut, sens, spec, sens + spec - 1.0))
    wp = [w for g, w, _ in rows if g == 1]
    wn = [w for g, w, _ in rows if g == 0]
    print("   waist-to-height ratio on the same people: area {:.4f}"
          .format(auc(wp, wn)))
    gate = 0.5200
    both_pos = sum(1 for g, w, t in rows
                   if g == 1 and w >= gate and t >= best_cut)
    both_neg = sum(1 for g, w, t in rows
                   if g == 0 and not (w >= gate and t >= best_cut))
    print("   two-step rule, waist ratio at or above {:.2f} and then the"
          " index:".format(gate))
    print("   sensitivity {:.4f}, specificity {:.4f}, sum minus one {:.4f}"
          .format(both_pos / len(pos), both_neg / len(neg),
                  both_pos / len(pos) + both_neg / len(neg) - 1.0))
    print("   so the blood test adds {:.4f} to the waist measurement alone"
          .format(auc(pos, neg) - auc(wp, wn)))

Single source and citation

Fan, Y. (2026). Insulin-Glucagon Bistability, Visceral Lipolysis Kinetics and Linear-Programming Diet Optimization (Version 1.0.0), Chapter 4: Two Cheap Measurements. 5D Library. https://doi.org/10.5281/zenodo.24090248

DOI: 10.5281/zenodo.24090248 · Read the monograph · 5DL-B-095 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026095,
  author    = {Fan, Yafu},
  title     = {Insulin-Glucagon Bistability, Visceral Lipolysis Kinetics and Linear-Programming Diet Optimization},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090248},
  url       = {https://doi.org/10.5281/zenodo.24090248}
}

Other chapter answers in this book