An MCMC sampler, such as NUTS or Metropolis, could take some time before it converges; that is, it starts sampling from the correct distribution. As we previously explained, MCMC methods come with theoretical guarantees of convergence under very general conditions and an infinite number of samples. Unfortunately, in practice, we only can get a finite sample, so we must rely instead on empirical tests that provide, at best, hints or warnings that something bad could be happening when they fail but do not guarantee everything is OK when they do not fail.

One way to visually check for convergence is to run the ArviZ plot_trace function and inspect the result. To better understand what we should look for when inspecting these plots, ...

Get Bayesian Analysis with Python - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.