A random-walk Metropolis chain proposes Y = Xi + b Z and accepts it with probability min(1, f(Y)/f(Xi)). Small b: almost every move is accepted but the chain crawls. Large b: most moves are rejected and the chain sits still. Both make successive draws strongly correlated, so N draws carry the information of far fewer independent ones (the effective sample size). Top: the chain and its histogram against the target. Bottom left: the autocorrelation of F(Xi), which is Uniform(0, 1) under the target, so it exists even for the Cauchy. Bottom right: acceptance rate and ESS/N over a whole range of step sizes, the same seed for each.
One step: a Normal draw Z (the proposal), then a uniform U; accept if U < r (Remark 24.8). The independence sampler proposes Y = b Z, i.e. g = N(0, b²), and accepts with probability min(1, f(Y)g(Xi)/(f(Xi)g(Y))). The integrated autocorrelation time τ = 1 + 2Σρk is estimated by Geyer's initial positive sequence (pairs of autocorrelations are added while their sum is positive, up to lag N/2) and ESS = N/τ. The KS distance is sup |FN − F|. The sweep runs chains of length min(N, 5000) at 29 step sizes from 0.03 to 100. Exercise 24.4 is sampled on the scale W = log Z, with the Jacobian included in the target.
code/ch24_simulation_methods.py (metropolis, acf, iat, demo_mh; Figures 24.2 and 24.S4).