Drawn samples Leapfrog tree path Current chain position

No-U-Turn Sampler: 2D Contour, Phase-Space and Energy View

The No-U-Turn Sampler (NUTS) is the algorithm quietly doing the heavy lifting inside Stan, PyMC and NumPyro every time a real Bayesian model gets fit. This 2D companion runs the exact same NUTS mechanism — momentum resampling, binary-tree leapfrog doubling, the no-U-turn stopping rule (θ⁺−θ⁻)·r ≥ 0 — but visualises it the way statisticians actually read diagnostics: a pannable/zoomable top-down contour map of the curved "banana" posterior with live marginal histograms along its edges, a momentum phase-space portrait, and a Hamiltonian energy trace that reveals numerical divergence directly instead of hiding it behind a 3D orbit camera. Adjust the step size and maximum tree depth, run Auto-Sample, and watch the accumulated draws and marginal histograms converge onto the posterior's true bent shape.