6  Boundaries and Error

How accurate does a thermometer need to be? The question sounds as if it belongs to the instrument maker. It doesn’t. A thermometer that reads within half a degree is perfectly good for deciding whether to wear a sweater. It’s not good enough for deciding whether a child has a fever. The instrument is the same in both cases. What changed is the boundary.

That’s the argument of this chapter: the accuracy a measurement needs is set by its categories, not by its instrument. “How accurate must it be?” has no answer until we know where the lines are, and how close to them our readings fall.

Show the setup code
## graphics
library(ggplot2)
library(patchwork)

6.1 Harmless in the middle, decisive at the edge

Suppose a thermometer reads 36.8 °C when the true temperature is 37.0. That error changes nothing. Both readings are normal, and nobody does anything differently. Now suppose it reads 38.1 when the truth is 37.9. The error is the same size, but now it changes the diagnosis. The child stays home, a parent misses work, perhaps a doctor is called.

What matters isn’t the size of the error. It’s the size of the error relative to the distance to the nearest boundary.

Show the code
# ch06_fig1_misclassification.R -- MRC chapter 6, figure 1
# The misclassification curve: probability that ONE reading lands in a different
# category from the true value, as a function of the true value.
# Boundaries and error SDs are ILLUSTRATIVE (verify list: 38.0 C fever; high-fever line).
library(ggplot2)

boundaries <- c(38.0, 39.5)                 # deg C: normal | fever | high fever
cats       <- c("normal", "fever", "high fever")
sigmas     <- c(0.1, 0.2, 0.3)              # SD of a single reading, deg C
truth      <- seq(36.5, 41.0, by = 0.005)

# P(reading falls outside the true value's category). Intervals are left-closed:
# a reading of exactly 38.0 counts as fever (argument step 2: the on-the-line rule).
p_wrong <- function(t, b, s) {
  edges <- c(-Inf, b, Inf)
  k  <- findInterval(t, b)
  lo <- edges[k + 1]; hi <- edges[k + 2]
  1 - (pnorm((hi - t) / s) - pnorm((lo - t) / s))
}

d <- expand.grid(truth = truth, sigma = sigmas)
d$p <- mapply(p_wrong, d$truth, MoreArgs = list(b = boundaries), s = d$sigma)
d$sigma_lab <- factor(sprintf("\u00B1%.1f \u00B0C", d$sigma), levels = sprintf("\u00B1%.1f \u00B0C", sigmas))

# Width of the zone where a single reading is wrong more than 5% of the time
z5   <- qnorm(0.95)         # one-sided: P(wrong side) > 5% when |t - b| < 1.645 sigma
band <- data.frame(b = boundaries, half = z5 * 0.2)

bands <- data.frame(xmin = c(min(truth), boundaries), xmax = c(boundaries, max(truth)), cat = cats)
bands$mid <- (bands$xmin + bands$xmax) / 2

pal <- c("#1b6ca8", "#d1495b", "#3a3a3a")

g <- ggplot() +
  geom_rect(data = bands, aes(xmin = xmin, xmax = xmax, ymin = -Inf, ymax = Inf),
            fill = c("#f4f7fa", "#fbf3ee", "#f8ecec"), colour = NA) +
  geom_rect(data = band, aes(xmin = b - half, xmax = b + half, ymin = -Inf, ymax = Inf),
            fill = "grey60", alpha = 0.18, colour = NA) +
  geom_vline(xintercept = boundaries, linetype = "22", colour = "grey35", linewidth = 0.4) +
  geom_hline(yintercept = 0.05, linetype = "13", colour = "grey45", linewidth = 0.35) +
  geom_line(data = d, aes(truth, p, colour = sigma_lab), linewidth = 0.8) +
  geom_text(data = bands, aes(x = mid, y = 0.56, label = cat), colour = "grey25", size = 3.6, fontface = "italic") +
  annotate("text", x = 36.55, y = 0.058, label = "5%", hjust = 0, size = 3, colour = "grey40") +
  annotate("point", x = 37.8, y = 1 - pnorm(1), size = 2.2, colour = pal[2]) +
  annotate("segment", x = 37.0, xend = 37.77, y = 0.30, yend = 1 - pnorm(1) + 0.01, colour = "grey45", linewidth = 0.3) +
  annotate("text", x = 36.6, y = 0.335, hjust = 0, size = 3, colour = "grey20",
           label = sprintf("How to read: true temperature 37.8 \u00B0C, a \u00B10.2 \u00B0C thermometer:\n%.0f%% of single readings will say 'fever'.", 100 * (1 - pnorm(1)))) +
  scale_colour_manual(values = pal, name = "reading error (1 SD)") +
  scale_y_continuous(labels = function(x) paste0(round(100 * x), "%"), limits = c(0, 0.6),
                     breaks = seq(0, 0.5, 0.1), expand = c(0, 0)) +
  scale_x_continuous(breaks = seq(36.5, 41, 0.5), expand = c(0, 0)) +
  labs(x = "true body temperature (\u00B0C)",
       y = "chance a single reading lands in the wrong category") +
  theme_minimal(base_size = 11) +
  theme(panel.grid.minor = element_blank(), panel.grid.major.x = element_blank(),
        legend.position = "top", legend.justification = "left",
        plot.margin = margin(8, 14, 8, 8))

out <- "G:/My Drive/Projects/MRC/figures"
ggsave(file.path(out, "ch06_fig1_misclassification.png"), g, width = 7.5, height = 4.6, dpi = 300, bg = "white")
ggsave(file.path(out, "ch06_fig1_misclassification.pdf"), g, width = 7.5, height = 4.6, device = cairo_pdf)
g
Figure 6.1: The chance that a single reading falls on the wrong side of the 38.0 °C fever boundary, by true temperature, for thermometers of three different accuracies.

Each curve is near zero far from the line and climbs to a coin toss right at it. A better thermometer makes the zone of doubt narrower, but no thermometer makes it disappear. Every boundary has a band around it where a single reading can’t be trusted to land on the right side.

6.2 On the line

Every boundary also needs a rule for the value that falls exactly on it. Is 38.0 °C a fever, or does a fever start just above 38.0? Is a 32 °F night a frost night? These sound like quibbles, but readings land on the line more often than we might think, because instruments and observers round. A display that shows 38.0 is covering everything from 37.95 to 38.05.

Show the code
# ch06_fig4_eugene_frost.R -- MRC chapter 6, figure 4
# Freezing as a boundary, with real data: Eugene, Oregon (GHCN-Daily USW00024221, Eugene Airport).
# TMIN is stored in tenths of deg C; observations were made in whole deg F, so round() recovers them.
# Cold season = Oct-Apr, seasons 1995/96-2024/25 (labelled by autumn year). Last spring frost: Jan-Jun, 1996-2025.
library(ggplot2); library(patchwork)
x <- read.csv("G:/My Drive/Projects/MRC/data/GHCND_USW00024221_Eugene.csv", stringsAsFactors = FALSE)
x$date <- as.Date(x$DATE); x$tmin <- round(x$TMIN / 10 * 9/5 + 32); x <- x[!is.na(x$tmin), ]
x$yr <- as.integer(format(x$date, "%Y")); x$mo <- as.integer(format(x$date, "%m"))
x$season <- ifelse(x$mo >= 7, x$yr, x$yr - 1)
cs <- x[x$mo %in% c(10:12, 1:4) & x$season >= 1995 & x$season <= 2024, ]
nseas <- length(unique(cs$season))

# ---- panel a: the value ON the line ----
h <- as.data.frame(table(tmin = cs$tmin)); h$tmin <- as.integer(as.character(h$tmin)); h <- h[h$tmin >= 18 & h$tmin <= 46, ]
h$grp <- ifelse(h$tmin == 32, "on", ifelse(h$tmin %in% c(31, 33), "near", "other"))
pct32 <- 100 * mean(cs$tmin == 32)
le <- sum(cs$tmin <= 32) / nseas; lt <- sum(cs$tmin < 32) / nseas
ga <- ggplot(h, aes(tmin, Freq / nseas, fill = grp)) +
  annotate("rect", xmin = -Inf, xmax = 32, ymin = -Inf, ymax = Inf, fill = "#f4f7fa") +
  geom_col(width = 0.82) +
  annotate("segment", x = 32, xend = 32, y = 0, yend = 12.2, linetype = "22", colour = "grey35", linewidth = 0.4) +
  scale_fill_manual(values = c(on = "#d1495b", near = "#e9a3ab", other = "grey72"), guide = "none") +
  annotate("text", x = 18.5, y = 19.6, hjust = 0, vjust = 1, size = 3, colour = "grey15", lineheight = 1.05,
           label = sprintf("How to read: each bar counts nights per winter with that whole-degree\nminimum. The red bar (%.0f%% of all cold-season nights) sits exactly\non 32 \u00B0F. Count it as frost (\u2264 32) and Eugene has %.0f frost nights a\nwinter; don't (< 32) and it has %.0f. The rule for the line decides.", pct32, le, lt)) +
  scale_x_continuous(breaks = seq(18, 46, 2), expand = c(0.01, 0)) +
  scale_y_continuous(expand = c(0, 0), limits = c(0, 20), breaks = seq(0, 15, 5)) +
  labs(x = "nightly minimum temperature (\u00B0F), October\u2013April", y = "nights per winter", tag = "a") +
  theme_minimal(base_size = 11) + theme(panel.grid.minor = element_blank(), panel.grid.major.x = element_blank())

# ---- panel b: the boundary in time ----
sp <- x[x$mo <= 6 & x$yr >= 1996 & x$yr <= 2025, ]
lf <- do.call(rbind, lapply(c(31, 32, 33), function(th) {
  r <- do.call(rbind, lapply(split(sp, sp$yr), function(d) { k <- which(d$tmin <= th)
    data.frame(yr = d$yr[1], doy = if (length(k)) as.integer(format(d$date[max(k)], "%j")) else NA_integer_) }))
  r$th <- th; r }))
lf$th_lab <- factor(sprintf("\u2264 %d \u00B0F", lf$th), levels = sprintf("\u2264 %d \u00B0F", c(31, 32, 33)))
rng <- aggregate(doy ~ yr, lf, range); rng <- data.frame(yr = rng$yr, lo = rng$doy[, 1], hi = rng$doy[, 2])
w <- reshape(lf[, c("yr", "th", "doy")], idvar = "yr", timevar = "th", direction = "wide")
w$s <- w$doy.33 - w$doy.32; big <- w[which.max(w$s), ]; med <- median(abs(w$s), na.rm = TRUE)
pal <- c("#1b6ca8", "#d1495b", "#3a3a3a")
brk <- as.integer(format(as.Date(c("2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01")), "%j"))
gb <- ggplot() +
  geom_segment(data = rng, aes(x = yr, xend = yr, y = lo, yend = hi), colour = "grey70", linewidth = 0.5) +
  annotate("segment", x = big$yr, xend = big$yr, y = big$doy.31, yend = big$doy.33, colour = "grey25", linewidth = 1.1) +
  geom_point(data = lf, aes(yr, doy, colour = th_lab), size = 1.8) +
  scale_colour_manual(values = pal, name = "last spring night at or below") +
  annotate("text", x = 1995.3, y = 216, hjust = 0, vjust = 1, size = 3, colour = "grey15", lineheight = 1.05,
           label = sprintf("How to read: each column is one spring; the gray line spans the last-frost dates given by the three\nthresholds. In most years moving the line from 32 to 33 \u00B0F moves the last frost %g days (median);\nin %d (dark line) it moves it %d days.", med, big$yr, big$s)) +
  scale_y_continuous(limits = c(NA, 217), breaks = brk, labels = c("1 Mar", "1 Apr", "1 May", "1 Jun")) +
  scale_x_continuous(breaks = seq(1996, 2024, 4)) +
  labs(x = NULL, y = "date of last spring frost", tag = "b") +
  theme_minimal(base_size = 11) + theme(panel.grid.minor = element_blank(), legend.position = "top", legend.justification = "left")

g <- ga / gb + plot_layout(heights = c(1, 1.05))
out <- "G:/My Drive/Projects/MRC/figures"
ggsave(file.path(out, "ch06_fig4_eugene_frost.png"), g, width = 7.5, height = 8.2, dpi = 300, bg = "white")
ggsave(file.path(out, "ch06_fig4_eugene_frost.pdf"), g, width = 7.5, height = 8.2, device = cairo_pdf)
attr(g, "stats") <- list(pct32 = pct32, le = le, lt = lt, big = big, med = med, nseas = nseas)
g
Figure 6.2: Frost at Eugene, Oregon, cold seasons 1995/96 to 2024/25: (a) nights per winter by whole-degree minimum temperature; (b) the last spring frost under three nearby thresholds.

The Eugene airport record shows how much the rule matters. Over thirty winters, about one cold-season night in twenty had a minimum of exactly 32 °F. Count those nights as frost and Eugene has about 50 frost nights a winter. Leave them out and it has about 39. Same thermometer, same nights, a fifth of the frost nights gone by a choice of symbol: “at or below” versus “below.”

The second panel shows something stranger. The date of the last spring frost is a boundary in time, and it depends on a boundary in value. In most years, moving the frost line from 32 to 33 °F moves the last frost by only a few days. In one recent spring it moved it by almost two months, because a single cold night in late spring sat at 33. A tiny change in one boundary produced a huge change in another. That kind of sensitivity is a theme of the companion document on time.

6.3 Buffer categories

When error is large compared with the width of a category, institutions often add a category to hold the doubt. Blood pressure has “elevated,” between normal and hypertension. Blood sugar has “prediabetes.” Metrologists, who make measurement their business, build “guard bands” into their decision rules: a part is accepted only if its measurement is far enough inside the limit that error can’t carry it outside.

A buffer category is error made visible. It says: in this band, we don’t trust a single reading, so we’ll call it something in between and look again.

6.4 Cost places the boundary

Freezing nights are burned into my childhood memories. I grew up in Southern California surrounded by orange groves. On a night when a freeze was predicted, the growers lit smudge pots among the trees to keep the temperature up and save the crop. By morning a layer of black soot covered everything, and it took real effort to clean off. It didn’t happen often where we lived, so the forecasts mattered. Lighting the pots was expensive and messy. Not lighting them, on a night that did freeze, could cost the whole crop.

That’s the general pattern. When the two kinds of mistake cost different amounts, the best place to act isn’t the nominal boundary. Gardeners cover tender plants when the forecast calls for 35 °F, not 32, because a frost on the leaves can come before the air at eye level reaches freezing, and losing the plants is worse than an evening spent with old sheets. The fuel-gauge ladder in Chapter 3 follows the same logic: running dry on a remote interstate costs far more than an early stop for gas. Weather warnings are issued knowing that some will be false alarms, because a missed tornado costs far more than an unneeded trip to the basement.

Show the code
# ch06_fig2_cost_threshold.R -- MRC chapter 6, figure 2
# Cost moves the boundary. A single reading x (error SD sigma) must be called
# 'fever' or 'normal'. Calling fever costs C_f if wrong; calling normal costs C_m if wrong.
# Best rule: call fever when P(true >= 38 | x) > C_f / (C_f + C_m).
# With a flat prior, P(true >= 38 | x) = pnorm((x - 38) / sigma), so the best threshold is
#   x* = 38 + sigma * qnorm(C_f / (C_f + C_m))
# Key point: with sigma = 0 cost changes nothing -- cost moves the line only BECAUSE of error.
# Values ILLUSTRATIVE; flat prior is a simplification.
library(ggplot2)

b      <- 38.0
sigmas <- c(0.1, 0.2, 0.3)
ratio  <- exp(seq(log(1/20), log(20), length.out = 400))   # how many times worse a MISS is than a false alarm

d <- expand.grid(ratio = ratio, sigma = sigmas)
d$thr <- b + d$sigma * qnorm(1 / (1 + d$ratio))            # C_f/(C_f+C_m) with C_f = 1, C_m = ratio
d$sigma_lab <- factor(sprintf("\u00B1%.1f \u00B0C", d$sigma), levels = sprintf("\u00B1%.1f \u00B0C", sigmas))

ex <- data.frame(ratio = 5, thr = b + 0.2 * qnorm(1/6))
pal <- c("#1b6ca8", "#d1495b", "#3a3a3a")

g <- ggplot() +
  annotate("rect", xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = b, fill = "#f4f7fa") +
  annotate("rect", xmin = -Inf, xmax = Inf, ymin = b, ymax = Inf, fill = "#fbf3ee") +
  geom_hline(yintercept = b, linetype = "22", colour = "grey35", linewidth = 0.4) +
  geom_vline(xintercept = 1, linetype = "13", colour = "grey55", linewidth = 0.35) +
  geom_line(data = d, aes(ratio, thr, colour = sigma_lab), linewidth = 0.8) +
  geom_point(data = ex, aes(ratio, thr), size = 2.2, colour = pal[2]) +
  annotate("segment", x = 5, xend = 5, y = 38.27, yend = ex$thr + 0.025, colour = "grey45", linewidth = 0.3) +
  annotate("text", x = 5, y = 38.31, hjust = 0.5, size = 3, colour = "grey25",
           label = sprintf("miss 5\u00D7 worse: call fever at %.2f \u00B0C", ex$thr)) +
  annotate("text", x = 1/19, y = b + 0.015, hjust = 0, vjust = 0, size = 3, colour = "grey30",
           label = "nominal boundary 38.0 \u00B0C") +
  annotate("text", x = 1/19, y = 37.47, hjust = 0, size = 3.2, colour = "grey30", fontface = "italic",
           label = "\u2190 a false alarm is worse") +
  annotate("text", x = 19, y = 37.47, hjust = 1, size = 3.2, colour = "grey30", fontface = "italic",
           label = "a miss is worse \u2192") +
  annotate("text", x = 1.08, y = 38.52, hjust = 0, size = 3, colour = "grey40", label = "equal costs") +
  scale_x_log10(breaks = c(1/20, 1/10, 1/5, 1/2, 1, 2, 5, 10, 20),
                labels = c("1/20", "1/10", "1/5", "1/2", "1", "2", "5", "10", "20"), expand = c(0, 0)) +
  scale_y_continuous(limits = c(37.4, 38.6), breaks = seq(37.4, 38.6, 0.2), expand = c(0, 0)) +
  scale_colour_manual(values = pal, name = "reading error (1 SD)") +
  labs(x = "cost of a missed fever \u00F7 cost of a false alarm (log scale)",
       y = "best reading at which to call 'fever' (\u00B0C)") +
  theme_minimal(base_size = 11) +
  theme(panel.grid.minor = element_blank(), legend.position = "top", legend.justification = "left",
        plot.margin = margin(8, 14, 8, 8))

out <- "G:/My Drive/Projects/MRC/figures"
ggsave(file.path(out, "ch06_fig2_cost_threshold.png"), g, width = 7.5, height = 4.6, dpi = 300, bg = "white")
ggsave(file.path(out, "ch06_fig2_cost_threshold.pdf"), g, width = 7.5, height = 4.6, device = cairo_pdf)
g
Figure 6.3: The best reading at which to call a fever, as the cost of a missed fever grows relative to the cost of a false alarm, for thermometers of three accuracies.

How to read it: start at the right, where a missed fever is five times as costly as a false alarm. With a thermometer accurate to about 0.2 °C, the best place to call a fever is no longer 38.0 but about 37.8. The worse the thermometer, the farther the best line moves. And notice what happens at the center: with equal costs, all three lines cross at 38.0. Cost moves the boundary only because of error. With a perfect instrument, there would be nothing to hedge against.

6.5 Measuring again

The obvious remedy for error is to measure again. Averaging several readings shrinks the error, and most medical rules require it. High blood pressure, for instance, is supposed to be diagnosed from readings taken on more than one occasion.

There’s a subtler reason for those rules. People who are picked out because a reading crossed a boundary will, on average, read lower the next time. Some of them crossed because their true value is high. Others crossed because the error happened to push them over that day. On the second reading the error is fresh, and that second group tends to drift back. Statisticians call it regression to the mean. It’s an artifact the boundary creates: without the line, nobody would have been selected, and nothing would appear to change.

6.6 Boundaries move while measurements stand still

Sometimes it’s the boundary that moves. In 2017 two American medical societies lowered the line for hypertension from 140/90 to 130/80. Nobody’s blood pressure changed that day. Millions of people’s categories did.

Show the code
# ch06_fig3_bp_reclassification.R -- MRC chapter 6, figure 3
# The boundary moves; the readings stand still. The SAME NHANES 2017-2018 blood-pressure
# readings classified by JNC7 (2003) and by the 2017 ACC/AHA guideline.
# Measured BP only (treatment status ignored); mean of available readings 1-3;
# adults 18+; weighted by WTMEC2YR (MEC exam weights). Thresholds verified 2026-10-30.
library(ggplot2)
dd <- "G:/My Drive/Projects/MRC/data"
bp <- haven::read_xpt(file.path(dd, "BPX_J.xpt"))
de <- haven::read_xpt(file.path(dd, "DEMO_J.xpt"))
x  <- merge(bp, de[, c("SEQN", "RIDAGEYR", "WTMEC2YR")], by = "SEQN")
x  <- x[x$RIDAGEYR >= 18, ]
sy <- as.matrix(x[, c("BPXSY1", "BPXSY2", "BPXSY3")])
di <- as.matrix(x[, c("BPXDI1", "BPXDI2", "BPXDI3")]); di[di == 0] <- NA   # 0 = not recordable
x$sbp <- rowMeans(sy, na.rm = TRUE); x$dbp <- rowMeans(di, na.rm = TRUE)
x  <- x[is.finite(x$sbp) & is.finite(x$dbp) & x$WTMEC2YR > 0, ]

jnc <- with(x, ifelse(sbp >= 160 | dbp >= 100, 4, ifelse(sbp >= 140 | dbp >= 90, 3,
            ifelse(sbp >= 120 | dbp >= 80, 2, 1))))
acc <- with(x, ifelse(sbp >= 140 | dbp >= 90, 4, ifelse(sbp >= 130 | dbp >= 80, 3,
            ifelse(sbp >= 120, 2, 1))))
lab_j <- c("normal", "prehypertension", "stage 1", "stage 2")
lab_a <- c("normal", "elevated", "stage 1", "stage 2")
w <- x$WTMEC2YR / sum(x$WTMEC2YR)
fl <- aggregate(w, by = list(from = jnc, to = acc), FUN = sum); names(fl)[3] <- "p"

# --- stacked bars + ribbons (manual alluvial) ---
xl <- 1; xr <- 2; bw <- 0.14
segL <- aggregate(p ~ from, fl, sum); segL$top <- cumsum(segL$p); segL$bot <- segL$top - segL$p
segR <- aggregate(p ~ to,   fl, sum); segR$top <- cumsum(segR$p); segR$bot <- segR$top - segR$p
fl <- fl[order(fl$from, fl$to), ]
fl$l0 <- NA; fl$r0 <- NA
for (i in unique(fl$from)) { k <- fl$from == i; fl$l0[k] <- segL$bot[segL$from == i] + c(0, head(cumsum(fl$p[k]), -1)) }
o <- order(fl$to, fl$from)
for (j in unique(fl$to)) { k <- which(fl$to == j); k <- k[order(fl$from[k])]; fl$r0[k] <- segR$bot[segR$to == j] + c(0, head(cumsum(fl$p[k]), -1)) }
sig <- function(t) (1 - cos(pi * t)) / 2
tt <- seq(0, 1, length.out = 60)
rib <- do.call(rbind, lapply(seq_len(nrow(fl)), function(i) {
  f <- fl[i, ]; xs <- (xl + bw/2) + tt * ((xr - bw/2) - (xl + bw/2))
  lo <- f$l0 + sig(tt) * (f$r0 - f$l0); hi <- lo + f$p
  data.frame(id = i, x = c(xs, rev(xs)), y = c(lo, rev(hi)), moved = f$from != f$to)
}))
fill4 <- c("#c9d6e3", "#e9d8a6", "#ee9b00", "#ae2012")
bars <- rbind(data.frame(x = xl, cat = segL$from, bot = segL$bot, top = segL$top, lab = lab_j[segL$from]),
              data.frame(x = xr, cat = segR$to,   bot = segR$bot, top = segR$top, lab = lab_a[segR$to]))
bars$pct <- sprintf("%s  %.0f%%", bars$lab, 100 * (bars$top - bars$bot))
htn_j <- sum(fl$p[fl$from >= 3]); htn_a <- sum(fl$p[fl$to >= 3])
moved_23 <- sum(fl$p[fl$from == 2 & fl$to == 3]); moved_all <- sum(fl$p[fl$from != fl$to])

g <- ggplot() +
  geom_polygon(data = rib, aes(x, y, group = id, fill = moved), colour = NA, alpha = 0.55) +
  scale_fill_manual(values = c(`FALSE` = "grey85", `TRUE` = "#ee9b00"), guide = "none") +
  geom_rect(data = bars, aes(xmin = x - bw/2, xmax = x + bw/2, ymin = bot, ymax = top),
            fill = fill4[bars$cat], colour = "white", linewidth = 0.6) +
  geom_text(data = bars[bars$x == xl, ], aes(x = x - bw/2 - 0.02, y = (bot + top)/2, label = pct), hjust = 1, size = 3.2) +
  geom_text(data = bars[bars$x == xr, ], aes(x = x + bw/2 + 0.02, y = (bot + top)/2, label = pct), hjust = 0, size = 3.2) +
  annotate("text", x = xl, y = 1.07, label = "JNC7 (2003)", fontface = "bold", size = 3.6) +
  annotate("text", x = xr, y = 1.07, label = "ACC/AHA (2017)", fontface = "bold", size = 3.6) +
  annotate("text", x = xl, y = -0.06, size = 3.1, colour = "grey25", label = sprintf("hypertension: %.0f%%", 100 * htn_j)) +
  annotate("text", x = xr, y = -0.06, size = 3.1, colour = "grey25", label = sprintf("hypertension: %.0f%%", 100 * htn_a)) +
  annotate("label", x = 1.5, y = -0.2, size = 3, hjust = 0.5, fill = "white", colour = "grey15",
           label = sprintf("How to read: each band is the same group of adults on both sides. Their readings did not change,\nso the bands run straight across; only the names and boundaries changed. Orange bands (%.0f%% of adults)\nchanged label; the larger one (%.0f%%) was 'prehypertension' in 2003 and 'stage 1 hypertension' in 2017.", 100 * moved_all, 100 * moved_23)) +
  scale_x_continuous(limits = c(0.45, 2.55)) +
  scale_y_continuous(limits = c(-0.3, 1.12)) +
  theme_void(base_size = 11) +
  theme(plot.margin = margin(8, 8, 8, 8), plot.background = element_rect(fill = "white", colour = NA))

out <- "G:/My Drive/Projects/MRC/figures"
ggsave(file.path(out, "ch06_fig3_bp_reclassification.png"), g, width = 7.5, height = 5.8, dpi = 300, bg = "white")
ggsave(file.path(out, "ch06_fig3_bp_reclassification.pdf"), g, width = 7.5, height = 5.8, device = cairo_pdf)
attr(g, "stats") <- list(n = nrow(x), htn_j = htn_j, htn_a = htn_a, moved_23 = moved_23, moved_all = moved_all, flows = fl[, c("from","to","p")])
g
Figure 6.4: US adults classified by measured blood pressure under the 2003 and the 2017 guidelines (NHANES 2017-2018, survey-weighted).

We used the national health survey’s measured readings for about 5,200 adults to see what the change did. Under the old rules, about 19 percent of these adults had readings in the hypertension range. Under the new rules, about 39 percent did. A third of all adults changed label without any change in their readings. The bands in the figure run straight across, because the readings stood still. Only the names on either side changed.

6.7 A case: grading thousands of students

For many years I taught very large introductory classes, often 300 to 500 students. Every exam was multiple choice, and every course grade was a category, A through F, laid over a number. That’s a measurement-and-category problem in its purest form, and it taught me most of what this chapter says.

My first rule was that the cutoffs were fixed and announced in advance: 90 percent for an A, and so on down. If I were ever challenged, in a hearing or a court, I wanted to be able to show that the same standard had been applied to every student. With classes that size, the rule had to be one I could compute, not one that depended on my memory of a face.

Correcting the instrument. An exam is an instrument, and instruments have errors. Mine came in the form of bad questions. During an exam, if a student asked me to clarify a question, I noted which one. After the exam the university’s scoring service ran an item analysis, a statistical check of how each question had performed. A question that two or more students had needed explained, or that failed the statistical check, earned every student in the class one extra point. I didn’t throw the question out. A student who had answered it correctly got that point too, plus the original point for the right answer. Then I told the class plainly: “I made some mistakes on the questions, and I’ve given everyone credit to cover them.” The best students often finished the course above 100 percent.

Figure 6.5: The University of Hawaiʻi request form for machine scoring of an exam in my introductory biology course. The checked optional reports include the item analysis. Contact details are covered.

The form shows the machinery behind it. It offered two standard corrections of its own: a box for questions to omit, and one for points to add. I used neither. As the form warns, omitting a question would also have switched off the item analysis, and the extra point could only be decided after that analysis came back.

This is the mirror image of the blood-pressure case. There, the boundaries moved and the readings stood still. Here, the readings moved and the boundaries stood still. Arithmetically, adding a point to everyone is the same as lowering every cutoff by a point. Socially, it’s quite different. “I made a mistake on the test” keeps the published standard intact and puts the error where it belonged: in the instrument, and with me.

There was a side effect I hadn’t expected. Admitting to bad questions in front of a few hundred students made me work very hard to write fewer of them. Students get feedback on their performance with a score. In my case, I got feedback too.

A systematic error. In my first year teaching a large class, a student came to see me. “You do know,” she said, “that you’re scheduling your exams 28 days apart.” I hadn’t thought about it, and I should have. The schedule itself, not chance, could put the same students at a disadvantage on every exam. That’s a systematic error, built into the measurement. I changed the schedule. And I added a rule for the course grade, described below, that allowed for a bad day.

The thin band. The hardest cases were the ones sitting right at a cutoff, where the difference between a B and an A came down to a rounding error in the final average. The usual answer is “just round up at .5.” But always rounding a half up is biased upward, which is why statisticians and much software round a half to the nearest even number instead. That removes the bias and replaces it with something worse for a person: whether a student moves up depends on whether the digit before the half happens to be odd or even.

I wanted the decision to depend on something real. So for a narrow band just below each cutoff, set in advance and the same for every student, I added context, and the context was fixed by rule. A student in the band moved up to the higher grade if the scores showed one of three things:

  • Everyone can have a bad day. One exam far below the rest.
  • Learning how to learn. Scores that rose through the term.
  • It’s important not to give up. A final exam well above the earlier ones.

The gradebook computed all three for every student in the band and recorded which reason, if any, applied. Nothing depended on knowing the student. Outside the band, the average alone set the grade. Inside it, the pattern of the same scores decided. Over thousands of students and many years, no grade was ever challenged.

Each rule is a value, written down: forgiveness for a bad day, credit for learning, respect for persistence. And the rules only ever rounded up. That’s the cost argument from earlier in the chapter, applied by rule: in that band, I judged that wrongly holding a student down was the worse mistake.

6.8 The hidden rubric

I didn’t publish the band rules. With that many students, and little time to grade, I expected that announcing them would turn every borderline grade into a negotiation, mostly over how wide the band should be. Other measures, published and plain, showed the students I was being as fair as I could.

That makes my gradebook an example of something everyone meets from the other side: the hidden rubric. A boundary is applied to us, and we never see where it is.

The smoke alarm is the everyday case. It’s set to be very sensitive on purpose, because a missed fire costs lives. So burnt toast sets it off. The alarm measures particles in the air and can’t tell toast from a house fire, or steam from smoke. I once took a long shower in a motel on the morning of a scientific meeting, gathering my thoughts, and the steam tripped the alarm. There was no way to shut it off, and the frustration nearly ruined my day. The rule was fixed, the context was ignored, and the cost of the false alarm landed on me.

My driving road test, nearly seventy years ago in California, was a true hidden rubric. I failed on the first try. No explanation was given beyond “try again after some more practice.” I’m sure the examiner’s rubric covered many aspects of driving, but knowing there was a rubric didn’t help at all. I practiced and passed the next time. In those days a failure on the first try was almost guaranteed.

The contrast with a known category is striking. A category with published boundaries tells us where we stand and what would move us. A hidden rubric only tells us the result. My own gradebook sat in between: the rules were private, but every decision was computed the same way and recorded, so it could be checked.

6.9 People are tuned to boundaries too

Error isn’t only in instruments. Chapter 2 described how Russian speakers, whose language has separate words for light and dark blue, tell blues apart faster when the colors straddle their word boundary. We perceive differences more sharply across a boundary than within a category.

The flip side matters as much. Differences inside a category tend to go unnoticed. A temperature of 37.2 °C and one of 37.6 are both “normal,” even though for some patients the higher reading may be the first sign of trouble. Categories sharpen our attention at their edges and dull it everywhere else, a cost Chapter 10 takes up.

6.10 Accuracy belongs to the boundary

We usually describe an instrument by its accuracy, as if accuracy were a property of the device alone. This chapter suggests a different view. A reading is accurate enough when its error is small compared with its distance from the nearest line that matters. Far from any boundary, a crude instrument will do. Near one, no instrument is good enough on its own, and we fall back on rules: for the value on the line, for a buffer between categories, for the cost of each mistake, and for measuring again.

The line decides how carefully we have to look.