Stellar Grove · Research

Stellar Grove · Concrete Mathematical Modelling

Three traffic laws, one data set

Several speed-density laws look plausible. Can the data tell them apart, and does the choice matter?

Chapter 4 · Validation: accept, improve, or reject. A worked example rebuilt from the chapter's topic in Mike Mesterton-Gibbons, *A Concrete Approach to Mathematical Modelling*; the scenario and numbers are our own illustration, not the book's text. The detector data on this page are simulated from Greenberg's law with known parameters, so the methods can be checked against the truth (see the table at the end).

Headline: All three laws track the data closely (R² 0.91–0.99), yet AIC picks Greenberg decisively (weight 1.00), and residual patterns rule out the straight line. The choice matters: predicted lane capacity ranges from 1,442 to 1,693 vehicles an hour.

The problem

A loop detector records 120 one-minute readings of traffic density (vehicles per mile) and mean speed. Three classic laws describe how speed falls as density rises. Which one does the evidence support, and would picking the wrong one change the engineering answer (the lane's capacity)?

The candidates

Greenshields: v=vf(1−kkj)Greenberg: v=clnkjkUnderwood: v=vfe−k/km

Each has two parameters, so AIC differences come purely from fit. Each also implies a capacity qmax=maxkkv(k) (Greenshields vfkj/4, Greenberg ckj/e, Underwood vfkm/e).

Results

LawParametersR²AICAkaike weightRuns test pCV error (mph)Capacity (veh/h)
Greenshields (linear)v_f = 37.3, k_j = 181.40.913272.40.0000.0003.101,693
Greenberg (logarithmic)c = 17.3, k_j = 226.80.98651.41.0000.0481.231,442
Underwood (exponential)v_f = 52.6, k_m = 74.50.98188.90.0000.0001.451,442
Inside the data the three laws nearly coincide; they part company in the dense, congested regime
Inside the data the three laws nearly coincide; they part company in the dense, congested regime

Try it: inspect the residuals

Residuals by model

Slide between the three laws: a good model leaves residuals scattered around zero with no curve.

Key findings

Truth checks

CheckResult
Best AIC is the true (Greenberg) lawpass
95% interval for c covers 17.2pass
95% interval for k_j covers 228pass
Greenberg residuals show no sign runs (p > 0.05)fail
import numpy as np
from books.concrete_mathematics import equilibrium as eq, validation as va
rng = np.random.default_rng(42)
k = np.sort(rng.uniform(15, 190, 120))
v = eq.greenberg_speed(k, 17.2, 228) + rng.normal(0, 1.2, k.size)
fit = va.fit(lambda k, c, kj: c * np.log(kj / k), k, v, p0=[15, 250], names=["c", "k_j"])
print(np.round(fit.params, 2), np.round(fit.ci(), 1).tolist())

# → [ 17.28 226.81] [[16.9, 17.7], [221.4, 232.2]]

Assumptions and extensions