Markov chain Monte Carlo (MCMC)
How does one get the posterior distribution when it cannot be worked out by formula? MCMC generates a long chain of random values. Each value depends only on the previous one. The frequencies in the chain follow the posterior distribution.
Example: 4 chains, 1000 warmup steps discarded in each, then 2000 draws each: 8000 values for the parameter, from which mean and interval are computed.
Caution: The chains must agree and be long enough, otherwise the result is unreliable. Measures such as R-hat show this.