The geometric concept that explains why optimization and sampling are different problems. In a
d-dimensional unit normal with large d, the region containing almost all the posterior mass is an
annulus at distance ≈d from the origin — and the mode is not in it. The worked
100-dimensional example makes it concrete: the log density at the mode is −91.9, while the 99%
typical set spans (−162.0,−125.6). Optimization drives straight through the typical set to a
point that is not representative; HMC must cycle around the annulus instead.
Overview
Typical set via the log posterior density (Ch. 11.1, p. 193)
Writing
lp=logp(θ∣y)(the target function, or log posterior density)p(lp∣y)(the posterior density of the target function)
the typical set (at some level of coverage) is “the set of parameter values for which the log
density (the target function) is close to its median.”
“For all but the simplest models we can only compute p(θ∣y) up to an arbitrary multiplicative
constant, so we can only compute lp up to an arbitrary additive constant; this shifting has no
effect on the values of θ.”
The information-theoretic alternative, and why it is not used here. Another definition is
∣logp(θ∣y)+H∣<ϵ
for some ϵ, where H is the entropy
H=−E(lp∣y)=−∫log(p(θ∣y))p(θ∣y)dθ
“This can be considered a special case of the concept of typical set in information theory. … For
reasons discussed in Gelman (2020c), however, we prefer the definition of typical set that uses a
central posterior interval for lp.”
How to compute it from draws: “calculate lp=logp(θ∣y) for each simulation draw, then
order them and determine their 99% interval, then collect all the vectors θ that fall in those
draws.”
Main Content
The geometric picture
The annulus, and what it implies about algorithms (Ch. 11.1, p. 194)
“In a d-dimensional unit normal distribution with a high value of d, the typical set looks like an
annulus or sphere or doughnut, corresponding to the points whose distance from the origin is
approximately d.
This intuition helps us understand the different challenges of optimization, which goes straight to the
center of the sphere, passing right through the typical set, and Hamiltonian Monte Carlo and similar
algorithms, which essentially have to cycle around the sphere rather than directly cutting through the
center.”
The consequence stated bluntly: “An important consequence is that the posterior mode may not be
typical.”
The 100-dimensional demonstration (Ch. 11.1, p. 194, Figure 11.1)
The interval can also be computed exactly from the χd2 distribution:
-0.5*(d*log(2*pi) + qchisq(c(0.005, 0.995), d))
The stated purpose: “In an applied analysis there would be no reason to perform this computation; we
do it here just to clarify the definition. Our use of the typical set is more conceptual, to help us
understand the different behaviors of optimization and sampling.”
Reading Figure 11.1: “On the space of logp(θ∣y), the typical set is the large mass in the
middle of the distribution; on the space of θ, it is an annulus corresponding to the values that
are not too near or too far from the mode.”
Why chains start far away and pass through
“In optimization or Markov chain simulation it is usual to start far from the mode (because
high-dimensional space is vast, so it’s unlikely that a starting point would happen to be very close to
the center of the distribution), and then the paths will rapidly move toward the mode, going through the
typical set in the process.”
The typical set is not invariant to reparameterization
Nonlinear transformations change the typical set (Ch. 11.1, p. 195)
“If you transform θ nonlinearly, you’ll need to divide the density by the absolute value of the
determinant of the Jacobian of the transformation, that is, adding −log∣det(Jacobian)∣ to the
log density. The typical set of θ is the inverse image of a set defined on the log density … and
changing logp(θ∣y) by subtracting log∣detJacobian∣ will change the mapping and thus
change the inverse image.
This is not a big deal, nor is it a problem — if you nonlinearly transform θ, you’re changing the
geometry of the problem, so it makes sense that the typical set changes too. We should just be clear on
it.”
What the issue is not: “The issue here is not about cancellation of density and area in computing
total probability, nor is it about E(lpϕ) being different from E(lp).”
What it is: “Rather, the issue is that sets of constant lpϕ are different from sets of
constant lp. The rule for being in the typical set of θ is different from the rule for being in
the typical set of ϕ, because the inverse image sets are different.”
This is why reparameterization is a genuine computational intervention rather than cosmetics — the same
fact that makes the centered/non-centered choice in
Modeling Ideas to Address Computing Problems matter so much.
The conclusion, and its qualification
“If we want our simulations to be in the areas of parameter space where lp=logp(θ∣y) is near
its expectation, then we don’t particularly want to be at the mode of p(θ∣y). By definition, the
log density is at an extreme value, not at its expectation, when θ is at its mode.
What the book fits models with, and what may come next (Ch. 11 intro, p. 193)
“In the case studies we have used NUTS-HMC as implemented in Stan (Hoffman and Gelman 2014; Betancourt
2017a; Stan Development Team 2025) as it is computationally efficient and has a robust and efficient
implementation.
Other HMC variants may become more popular in the future:
microcanonical HMC (Robnik et al. 2023) — “for high-dimensional posteriors.”
Also worth noting the framing of “fitting”: “While this originally referred to finding a point estimate
for the parameters, the term ‘fitting’ now also refers to the process of obtaining simulations or other
posterior summaries given data.”