The science behind the simulator — why plain IDM misses the interesting
physics, and two Bayesian extensions that fix it:
MA-IDM (Gaussian-process driver
noise) and dynamic-regression IDM
(AR(p) driver noise).
The colour of the noise matters.
After fitting IDM to a real driver, the acceleration residual
\(\eta_n(t)\) is not white — its memory effect extends
over the past several seconds of driving. A deterministic ring road
already goes unstable and forms stop-and-go waves at high enough
density; what the colour of the residual changes is how
those waves are seeded, how persistent they are, and how much
spread the resulting flow–density states show.
This page explains the two Bayesian models the simulator is built
on, and why the temporal structure of \(\eta_n(t)\) matters for
simulation rather than only for goodness of fit.
White — B-IDM (i.i.d.)AR(p) — DR-IDMGP — MA-IDM
Sample realisations of \(\eta(t)\) for each noise model — same
marginal variance, very different temporal structure.
01
Motivation — why stochastic car-following?
Deterministic car-following models are elegant, parsimonious, and capture
the first-order dynamics of traffic flow very well. But real trajectory
data — HighD, NGSIM, any modern drone survey — looks nothing like a
deterministic simulation. Two facts drive this work:
① Residuals are large and persistent
After fitting IDM to a driver's trajectory, the acceleration residual
\(\eta_n(t) = \ddot x_n^{\mathrm{obs}}(t) - f_{\mathrm{IDM}}(\cdot)\)
has a marginal standard deviation on the order of
0.2 m/s² and a memory horizon spanning several seconds:
the MA-IDM GP lengthscale fitted on HighD is
\(\ell\approx 1.4\) s, and the residual still carries useful
information from the past ~5 s of driving (MA-IDM
analysis) — pushed out to ~10 s by the AR(p)
calibration. It is emphatically not white noise.
② Noise colour changes the macroscopic flow
White-noise residuals produce high-frequency jitter that largely
averages out. Correlated residuals push the same total
variance into low frequencies, which is the part a car-following
chain amplifies. The compare page lets you
vary the temporal structure and watch the effect — note that it runs
each model at its own calibrated noise scale, so the three rings do
not share a common marginal variance.
Parameters: desired speed \(v_0\), safe time headway \(T\), minimum gap
\(s_0\), max acceleration \(a\), comfortable braking \(b\), acceleration
exponent \(\delta\). The stochastic extensions all replace the
deterministic acceleration with
In this simulator the only difference between the three modes is
the stochastic process assumed for \(\eta_n(t)\): every ring shares one
common IDM parameter vector. That is a deliberate ablation, not a
reproduction of the papers — there, each model is calibrated separately
and the ring experiments draw heterogeneous per-driver
parameters from the joint posterior, so \(\theta\) differs between models
as well. The simulator'sPreset menu
does load each paper's ring geometry and calibrated \(\theta\), but keeps
every driver identical.
03
MA-IDM — Memory-Augmented IDM
GP · MA-IDM
Bayesian Calibration of the Intelligent Driver Model
Key idea. Model the residual \(\eta_n(t)\) as a
zero-mean Gaussian process with a stationary covariance
kernel \(k(t,t')\). The GP endows the residual with memory:
how strongly \(\eta_n(t)\) depends on \(\eta_n(t-\tau)\) is
controlled entirely by the kernel.
The paper calibrates a squared-exponential (RBF) kernel and notes
that other kernels such as Matérn 5/2 could be used instead.
This simulator exposes four kernels (RBF and Matérn 5/2, 3/2,
1/2), all with the same marginal variance \(\sigma_k^{2}\) and
lengthscale \(\ell\); Matérn 3/2 and 1/2 are extensions
added for this demo, not options calibrated in the paper.
Smoother kernels (RBF) produce smoother acceleration noise; rougher
kernels (Matérn 1/2, the Ornstein–Uhlenbeck limit) produce
visibly jittery traces with the same long-run variance.
Simulation. The paper draws its GP residuals by
conditional Gaussian sampling with a pre-factorised covariance
matrix, whose factorisation cost is \(O(N^3)\) in the trajectory
length. To keep the browser interactive this simulator instead uses
a random-Fourier-feature (RFF) approximation
\(\eta(t)\approx \sigma\sqrt{2/M}\sum_{m=1}^{M}\cos(\omega_m t + b_m)\)
with \(\omega_m\) drawn from the kernel's spectral density, which
costs \(O(M)\) per step. With \(M=32\) the construction reproduces
the target covariance in expectation; any single
realisation deviates from it, and the marginal distribution is only
approximately Gaussian. It is an approximation to the paper's model,
not the paper's sampling scheme.
04
Dynamic-regression IDM — AR(p) noise
AR(p) · DR-IDM
Calibrating Car-Following Models via Bayesian Dynamic Regression
The coefficients \(\{\rho_1,\ldots,\rho_p\}\) are inferred jointly
with the IDM parameters in a fully Bayesian framework. The paper
compares orders via short-horizon RMSE / CRPS on HighD and
recommends \(p\approx 4\!-\!6\) (using AR(5) for its
demonstrations): too few lags underfit, while too many overfit and
cost more to fit. Table 1 of the paper reports posterior-mean
\(\boldsymbol\rho\) for \(p=1,\ldots,8\) and Figure 6 compares
covariance functions up to \(p=10\); this simulator exposes
\(p=1,\ldots,7\) of those (HighD, 5 Hz sampling).
Why AR? AR(p) is the discrete-time analogue of a
low-order linear SDE. It is cheap to simulate (\(O(p)\) per step,
no matrix factorisations), and exactly stationary for every
\(\boldsymbol\rho\) in Table 1 — all eight coefficient vectors
have their characteristic roots outside the unit circle. The
dominant root sets the memory timescale. Note that \(\rho_1\) is
not the lag-1 autocorrelation unless \(p=1\): for
\(p=2\) the paper's \(\rho_1=1.234\) already exceeds 1. The implied
lag-1 autocorrelation follows from the Yule–Walker equations and is
remarkably stable across orders, \(\approx 0.99\) at the 0.2 s
sampling step.
On HighD, the paper evaluates 5 s simulations by RMSE and CRPS
(Table 2) and reports that the dynamic IDM outperforms both the
Bayesian IDM and MA-IDM, especially for \(p\ge 4\). Figure 9
adds the horizon dependence: MA-IDM performs well within about
4 s, beyond which its simulations become dominated by the
noise term and its accuracy approaches the Bayesian IDM's.
05
Baseline — B-IDM (white noise)
White · B-IDM
I.i.d. Gaussian residual (naive baseline)
The classical Bayesian IDM likelihood.
What falls out of a naive least-squares or Gaussian-likelihood
calibration: residuals are assumed independent across time.
Useful as a baseline precisely because its failure modes — washed-out
jam waves, unrealistic short-timescale oscillation — are exactly what
the two correlated models above are designed to fix.
06
Side by side
B-IDM (white)
DR-IDM (AR(p))
MA-IDM (GP)
Residual process
\(\eta_t \sim \mathcal N(0,\sigma^2)\), i.i.d.
\(\eta_t=\sum_i\rho_i\eta_{t-i}+\varepsilon_t\)
\(\eta(t)\sim\mathcal{GP}(0,k(\tau))\)
Memory
None
Roots of char. poly.
Kernel lengthscale \(\ell\)
Free parameters
\(\sigma\)
\(\sigma_\varepsilon\), \(\rho_1,\ldots,\rho_p\)
\(\sigma_k\), \(\ell\), kernel family
Cost per step
\(O(1)\)
\(O(p)\)
\(O(M)\) (random Fourier features)
Residual autocorrelation
Zero at every non-zero lag
Positive short-lag; negative over 5–10 s at the paper's recommended \(p\approx4\!-\!6\)
A microscopic traffic model that gives one vehicle’s acceleration as a function of its own speed and its relationship to the vehicle directly ahead. The IDM is one.
The continuous, collision-free car-following model of Treiber, Hennecke and Helbing (2000), with five interpretable parameters: v₀, T, s₀, a and b.
Driver noise / acceleration residual
The part of an observed acceleration that a fitted deterministic model does not explain, written η(t). Its standard deviation on HighD is around 0.2 m/s².
A cluster of stopped or slow vehicles that forms with no bottleneck and travels backwards against the direction of travel, typically at around 15–20 km/h.
Ring road experiment
A closed circular track with a fixed number of vehicles and no entries, exits or bottlenecks — the cleanest setting in which to show that congestion needs no external cause. After Sugiyama et al. (2008).
A distribution over functions in which any finite set of values is jointly Gaussian, specified by a mean and a covariance kernel. Here it supplies a residual with smooth, continuous-time memory.
Kernel lengthscale ℓ
The timescale of a stationary GP kernel: how far apart two instants must be before their residuals are effectively unrelated. The MA-IDM posterior mean on HighD is ℓ ≈ 1.435 s.
An autoregressive process in which each value is a weighted sum of the previous p values plus an independent innovation. DR-IDM uses one on the data’s 0.2 s grid.
The correlation of a signal with itself at lag τ. It is the sharpest way to tell the three noise models apart: identically zero for white noise, positive and decaying for a GP, sign-changing for AR(p).
The flow-versus-density relationship of a road section. Loops in a measured trajectory indicate non-stationary loading and unloading rather than a mis-measurement.
Time–space diagram
Position plotted against time for every vehicle, with colour encoding speed. Stop-and-go waves appear as diagonal bands with a negative slope.
Estimating a model’s parameters as a posterior distribution rather than a single best fit, which makes both parameter uncertainty and the structure of the residual part of the result.
08
Frequently asked questions
Why is a calibrated car-following residual not white noise?
Because the things the model leaves out are themselves persistent. A deterministic car-following model has no representation of distraction, of a driver’s momentary aggressiveness, of anticipation beyond the immediate leader, or of anything happening in the next lane — and none of those switch on and off from one video frame to the next. Fitting the IDM to HighD trajectories leaves a residual with a standard deviation near 0.2 m/s² whose autocorrelation decays over several seconds: about 5 s under the MA-IDM Gaussian-process fit, and out to roughly 10 s under the AR(p) calibration.
What does MA-IDM add to the Intelligent Driver Model?
MA-IDM, the memory-augmented IDM of Zhang & Sun (2024), keeps the IDM acceleration unchanged and replaces the independent Gaussian error term of a standard Bayesian calibration with a Gaussian process over time. The residual then has a covariance kernel instead of a single variance, so two free numbers describe the driver’s memory: a marginal scale and a lengthscale. Calibrated on HighD the lengthscale is about 1.435 s, meaning the residual stays informative for roughly three lengthscales, or about 5 s.
What does the dynamic-regression IDM (DR-IDM) do differently?
DR-IDM, from Zhang, Wang & Sun (2024), models the residual as an autoregressive process on a fixed time grid: each value is a weighted sum of the previous p values plus a fresh innovation. That is a discrete-time relative of the Gaussian-process view, and it buys two things — the coefficients are cheap to infer jointly with the IDM parameters, and the fitted autocorrelation is allowed to go negative at longer lags, which the simple stationary kernels cannot do. The paper recommends an order of about 4 to 6.
Which noise model should I use?
For a smooth, physically interpretable memory with two parameters, use the Gaussian process — the lengthscale is directly readable as a memory horizon. For a residual whose autocorrelation changes sign, or when you want the noise to live on the same discrete grid as your data, use AR(p) at order 4 to 6. Use white noise only as a baseline: it is what a standard Bayesian calibration assumes, and seeing how much it under-predicts jam formation is the point of keeping it available.
Does adding driver noise change the traffic jams, or only the picture?
It changes the outcome, not just the appearance. Noise seeds the instability that a perfectly uniform deterministic ring would never develop on its own, and the temporal correlation of that noise sets how efficiently it seeds it. The same total variance arranged as high-frequency jitter is largely averaged away by the car-following chain, while the same variance concentrated at low frequencies falls into the band the chain amplifies, producing earlier and deeper stop-and-go waves.
What is a fundamental diagram?
A fundamental diagram is the relationship between traffic flow, in vehicles per hour, and traffic density, in vehicles per kilometre, on a stretch of road. It rises roughly linearly in free flow, peaks at a capacity point, then falls again as congestion sets in. Because a jammed ring is not in a steady state, a measured trajectory through this plane forms loops rather than tracing a single curve, and those loops are the signature of loading and unloading as a wave passes the measurement arc.
Zhang, C., & Sun, L. (2024).
Bayesian Calibration of the Intelligent Driver Model.
IEEE Transactions on Intelligent Transportation Systems.
doi:10.1109/TITS.2024.3354102
[arXiv:2210.03571]
Zhang, C., Wang, W., & Sun, L. (2024).
Calibrating Car-Following Models via Bayesian Dynamic Regression.
Transportation Research Part C: Emerging Technologies, 104719.
doi:10.1016/j.trc.2024.104719
[arXiv:2307.03340]
BibTeX
@article{zhang2024maidm,
title = {Bayesian Calibration of the Intelligent Driver Model},
author = {Zhang, Chengyuan and Sun, Lijun},
journal = {IEEE Transactions on Intelligent Transportation Systems},
year = {2024},
doi = {10.1109/TITS.2024.3354102}
}
@article{zhang2024dynamicidm,
title = {Calibrating Car-Following Models via Bayesian Dynamic Regression},
author = {Zhang, Chengyuan and Wang, Wenshuo and Sun, Lijun},
journal = {Transportation Research Part C: Emerging Technologies},
year = {2024},
pages = {104719},
doi = {10.1016/j.trc.2024.104719}
}