Markov chain Monte Carlo constructs an ergodic Markov chain whose stationary distribution is the target law and uses its post-burn-in states as approximate dependent samples.
A characteristic duration or step count over which repeated measurements remain correlated. Integrated autocorrelation controls the variance of a sample mean, while exponential relaxation probes the slowest decay mode.
The initial segment of a Markov chain Monte Carlo run discarded to reduce dependence on its starting state. A fixed discarded count is a choice to assess using Markov chain Monte Carlo convergence diagnostics, not a proof that the retained sample has reached its stationary distribution.
A trace of a Markov chain Monte Carlo parameter helps distinguish slow movement, long rejection plateaus, and movement between separated regions. Very small random-walk proposals give high acceptance but slow diffusion; very large proposals produce low acceptance and repeated states. Record acceptance rates alongside trace plots and effective sample size of a Markov chain before deciding which scale to change. Correlated posterior directions often benefit from block proposals with a covariance fitted during a preliminary tuning run. A trace alone cannot prove convergence or identify the unique cause of poor movement; dispersed chains and stationary summaries provide additional evidence. Freeze tuning before the main sampling phase, or use adaptation satisfying an appropriate ergodicity theorem.
Coupling from the past uses a fixed two-sided sequence of random update maps for a finite Markov chain. Increase a backward horizon until the composition from that horizon to time zero sends every starting state to the same state. Retain the maps at previously exposed times. The resulting common image is an exact stationary sample. If a length- block has positive probability of mapping every state to one state, independent disjoint blocks imply failure to coalesce by horizon has probability at most . For a deterministic horizon, a stationary initial state yields a stationary final state, and agrees with the algorithm's output on coalescence. Letting the deterministic horizon tend to infinity proves the output has the stationary law without conditioning on a random stopping horizon.
If update maps preserve a finite partial order with a bottom and top state, it suffices to run those two extremal states from the same backward horizon. Equality of their time-zero images forces equality of all initial states by the order sandwich. For ferromagnetic Ising heat-bath updates, use the same updated vertex and uniform variable in every chain; the conditional probability of increases with every neighbour's spin. A block visiting all vertices once with all uniforms below the least conditional probability of maps every state to all plus, proving almost-sure termination.
Reversible-jump Markov chain Monte Carlo samples a posterior on a disjoint union of model-specific parameter spaces. A dimension-matching bijection between old parameters plus auxiliary variables and new parameters plus reverse auxiliary variables supplies a reversible proposal. Its acceptance ratio includes posterior-density, model-selection, proposal-density, and Jacobian determinant factors. The equal-dimension reversible-jump acceptance probability is the ordinary density-based special case.
To minimize over models with different parameter dimensions, sample from a target proportional to and cool . A dimension-matching proposal augments the smaller model by auxiliary variables, transforms them bijectively into the larger parameter vector, and includes the proposal probability density function and absolute Jacobian determinant in the Metropolis–Hastings acceptance probability. For a positive Poisson mean and normal parameters , one convenient transformation isIts absolute Jacobian determinant is one. If the forward and reverse model-jump selection probabilities are and , the Poisson-to-normal ratio isThe reverse ratio is its reciprocal at the inverse map. This enforces detailed balance. When the target is proper and the annealing chain explores it adequately, the low-temperature laws concentrate on the minimum Akaike information criterion, rather than the maximum marginal model evidence. Likelihoods compared across models must describe the same observed data with a compatible reference measure.
For one-parameter binomial and two-parameter normal models, the displayed dimension-matching map has inverse and absolute Jacobian determinant . With auxiliary density and model-jump probabilities , an annealing target proportional to gives forward acceptance ratioThe reverse ratio is its reciprocal at the inverse map. Keep model-dependent likelihood constants. Comparing continuous densities directly with discrete masses is not invariant to measurement units; a scientifically meaningful comparison needs models for the same recorded observations with a compatible reference measure, for example bin-integrated normal probabilities for integer-valued measurements.
For nested regression models, append one coefficient drawn from density while retaining the variance and existing coefficients . The dimension-matching map has absolute Jacobian one. With joint model/parameter target , birth-selection probability , and reverse death-selection probability , the displayed acceptance probability and its reciprocal death rule enforce detailed balance. Include normalized parameter-prior densities and a model-order prior in : constants that depend on model order cannot be dropped from a cross-model ratio.
A polynomial regression birth move can introduce a coefficient while shifting the intercept by , with the sample average of the new monomial. The fitted-value increment is , whose sample average vanishes. The Jacobian determinant of the coefficient transformation is one. A reversible-jump Markov chain Monte Carlo acceptance ratio must still include the normalized dimension-dependent prior distributions, the model-order prior distribution, the birth/death selection probabilities and the proposal density for .
A pseudo-prior is a proper density assigned to a parameter that is inactive under a particular model. Integrating it out leaves that model's likelihood and marginal evidence unchanged. Its choice affects movement between model states, but not the intended marginal posterior over models.
A pseudo-prior can make model parameter vectors have equal dimensions, allowing identity-matched RJ-MCMC moves. If active and inactive coordinates share the same prior density in the two augmented targets, these factors cancel in model-switch ratios. Within-model updates must preserve the augmented target, including the inactive coordinate's pseudo-prior law.
Compare independent Poisson means with one shared mean under proper shape-rate gamma distribution priors. Adding the second mean as an inactive parameter under the shared-mean model gives a simple identity model switch. With equal model priors and identical active/inactive priors, its ratio from separate to shared means is . Poisson-gamma conjugacy supplies exact within-model updates, and integrating the gamma kernels supplies an independent Bayes factor benchmark.
For unnormalized model posterior densities , model-selection probabilities and parameter-proposal densities , accept a proposal with the minimum of one and . A deterministic matching-map formulation instead includes its explicit Jacobian determinant; it must not be counted again when already absorbed into a direct proposal density.
The hit-and-run sampler moves within a full-dimensional compact convex set by choosing a uniform direction, then a uniform point on the chord through the current point in that direction. Its invariant law is the uniform distribution on the set. Starting in the interior keeps the chain in the interior almost surely. To define absolutely continuous transitions also at boundary points, redraw directions whose chords have zero length. Without this convention, a corner can have a positive holding atom.
For a planar hit-and-run sampler, let be the chord length and the fraction of directions with positive chord length. With zero-length chords redrawn, the probability density function isfor almost every in the body. Interior points have . The two signed representations of a direction contribute the factor two in the polar-coordinate calculation. If the body has diameter , a version of this density is bounded below by . This is a global Doeblin condition after normalization by the body's area.
Several chains from dispersed initial states, trace plots, autocorrelation, effective sample sizes, and the rank-normalized split potential scale reduction factor assess mixing and disagreement between chains. An close to one is useful evidence but cannot prove convergence or prove posterior propriety. Comparing chains that explore different modes is especially important; monitor each scientifically important observable and its Monte Carlo uncertainty. A long apparent plateau can also occur when an improper-target sampler is drifting toward a boundary.
The potential scale reduction factor compares variation within simulated chains to a variance estimate also incorporating differences between chains. In its classical form, , where is the average within-chain sample variance. Values appreciably above one indicate disagreement; values close to one do not prove convergence. Splitting chains helps expose changes over time, and modern rank-based variants improve robustness.[ref]
Stan Reference Manual by Stan Development Team. Posterior Analysis, “Potential scale reduction”, “Split R-hat for detecting non-stationarity”, and “Rank normalization helps when there are heavy tails”
A trace plot displays an observable along successive iterations of a Markov chain Monte Carlo algorithm. Its horizontal axis is iteration and its vertical axis is the observed parameter or function value. Trends suggest an initial transient or slow exploration, separated regimes suggest transitions between posterior regions, and exact plateaus show repeated states. The plot should be read with acceptance statistics, autocorrelation and multiple starting states; its visual appearance alone cannot prove stationarity or identify the unique cause of poor mixing.
Thinning keeps every th state of a Markov chain. The retained chain has transition kernel and the same stationary distribution. It is generally still dependent, and reducing correlation between retained draws does not by itself improve precision per original transition. Keep all post-warmup draws unless storage or later processing requires thinning; assess precision using the effective sample size of a Markov chain.
A Markov kernel is geometrically ergodic when its iterates converge to stationarity in total variation at a geometric rate, with a finite state-dependent prefactor.
For an aperiodic positive Harris recurrent Markov chain with geometric ergodicity, an observable with stationary moment for some satisfies a central limit theorem. Its asymptotic variance is , with stationary covariances. Ergodicity alone does not guarantee this theorem.
Uniform geometric ergodicity strengthens geometric ergodicity by bounding the prefactor uniformly over the starting state. If globally and is invariant, thenWrite , where draws independently from , to obtain the bound.
Applying a Markov kernel to two initial laws cannot increase their total variation distance, even for the distribution of an entire subsequent finite trajectory. If a bounded summand has absolute value at most , the variance of a length- path sum differs between these laws by at most times their total variation distance. Thus a geometrically long enough burn-in makes this difference negligible relative to .
For a reversible Markov chain with invariant law , its Markov kernel acts as a self-adjoint operator on . An absolute spectral gap means that on the mean-zero functions is at most . Geometric ergodicity implies this gap for a reversible chain. Indeed, for bounded mean-zero supported where the geometric prefactor is bounded, the total-variation estimate gives . The spectral theorem for normal operators puts its spectral measure in . Such test functions are dense in the mean-zero subspace.
If , a stationary reversible Markov chain satisfiesConsequently the variance of a sum of consecutive values is at most times the stationary variance of one value. This bounds the Markov chain Monte Carlo asymptotic variance uniformly over square-integrable functions.
For a stationary ergodic Markov chain with invariant distribution and an integrable function , the sample mean converges almost surely to . Geometric ergodicity supplies standard sufficient conditions for this conclusion and stronger limit theorems.
A minorization condition gives a common component of transition laws: for every in a specified set, some , , and a probability measure .
A Doeblin condition is a minorization of the whole state space. It implies uniform geometric convergence in total variation distance.
A geometric drift with , together with a small-set minorisation on and irreducibility and aperiodicity, implies geometric ergodicity.
A geometric drift condition requires a measurable , a small set , constants and , andTogether with irreducibility and aperiodicity, it implies geometric ergodicity. A global Doeblin condition allows to be the entire state space and .
Suppose a Markov kernel satisfies for a measurable . For and , the sublevel set gives . If is a small set, this is a geometric drift condition. The hypotheses of an irreducible Markov chain and an aperiodic Markov chain are also required for the usual geometric ergodicity theorem.
For a reversible kernel , the inequality is equivalent to geometric contraction of variance under iteration of .
One Markov kernel dominates another in Peskun ordering when it assigns at least as much transition probability to every measurable set not containing the current state. For reversible kernels this increases Dirichlet energy and cannot decrease the spectral gap.
Hamiltonian Monte Carlo introduces an auxiliary Gaussian momentum, approximately follows Hamiltonian dynamics by a reversible volume-preserving integrator, and applies a Metropolis correction.
Surrogate Hamiltonian Monte Carlo uses an auxiliary smooth probability density function to generate trajectories but applies a Metropolis–Hastings acceptance probability using the intended target . For Gaussian momenta and an involutive Metropolis proposal generated by flipped leapfrog integration, the acceptance probability is . Only the surrogate gradient is required during the trajectory; target density evaluations are still required at the endpoints.
The Metropolis–Hastings algorithm proposes from at state and accepts it with probabilityThis acceptance rule enforces detailed balance with the target density .
The Barker acceptance probability accepts a proposal using the displayed ratio. If and , the accepted flux is , symmetric in the two states. This proves detailed balance; define acceptance as zero when . Rejected proposals contribute to the diagonal transition probability. Replacing by an unnormalized target leaves the ratio unchanged. For a common proposal, shows that its acceptance probability never exceeds the Metropolis–Hastings acceptance probability. The name refers to A. A. Barker's work on Monte Carlo methods for a plasma; the initials are retained without an unverified expansion.[ref]
Monte Carlo Calculations of the Radial Distribution Functions for a Proton-Electron Plasma by A. A. Barker. Australian Journal of Physics 18, 119–134 (1965), bibliographic provenance
Represent a size- subset of objects by a binary vector with coordinate sum , where . Uniformly choosing one occupied and one unoccupied coordinate and swapping them gives equally likely neighbours. This proposal distribution is symmetric, so its forward and reverse factors cancel in the Metropolis–Hastings acceptance probability. Every state is connected to every other by a sequence of swaps, establishing an irreducible Markov chain when the target masses are positive. Symmetry and the acceptance rule give detailed balance with that target.
For a discrete uniform distribution as the prior distribution and a multivariate normal distribution for observations with covariance matrix and mean , the posterior distribution is proportional to . If , expanding the quadratic forms gives log acceptance ratio , and the log acceptance probability is its minimum with zero.
A Metropolis-within-Gibbs sweep updates one coordinate or block at a time by a Metropolis–Hastings algorithm transition whose invariant law is that block's full conditional distribution. For a proposal changing only block , the acceptance ratio uses the full joint target with the other coordinates fixed, together with the reverse/forward proposal ratio. Each block kernel preserves the joint posterior, so their composition does as well. Conjugate blocks can instead use exact Gibbs sampling draws. Systematic composition need not be reversible, even when every block kernel is reversible.
A pseudo-marginal Metropolis–Hastings algorithm replaces an intractable likelihood function by a nonnegative unbiased likelihood estimator and includes its auxiliary randomness in the state. If for , the extended target is proportional to . An independence proposal for new auxiliary randomness cancels the factors in the Metropolis–Hastings acceptance probability. On rejection the old estimate must be retained. Integrating the extended target gives the desired marginal posterior distribution exactly.
An unbiased likelihood estimator has expectation equal to the likelihood function at each parameter. A pseudo-marginal algorithm requires this estimator to be nonnegative. Importance sampling provides for independent random variables , provided the proposal covers the target support. Relative variance affects the mixing time even though unbiasedness guarantees the correct marginal target.
At the current state , a Metropolis–Hastings algorithm draws a candidate state from its proposal distribution . The Metropolis–Hastings acceptance probability corrects the proposal's bias so that the target distribution remains invariant.
An involutive Metropolis proposal uses a deterministic bijection satisfying . For a volume-preserving and target probability density function , accept with probability . The identity and a change of variables under prove detailed balance. A non-unit Jacobian determinant must be included when volume is not preserved.
For a proposal , with isotropic and an independent random orthogonal matrix , invariance of the distribution of under transpose makes the proposal distribution symmetric. Indeed , and averaging the isotropic Gaussian density over an inversion-invariant law yields . The Metropolis–Hastings algorithm therefore accepts with the target density ratio alone.
Let , let , and proposeThe proposal distribution is . If independently of , then is a jointly multivariate normal distribution invariant under exchanging and , because both random vectors have covariance matrix and their cross-covariance matrices are both . Consequently its density satisfieswhere is the standard-normal density. Thus the proposal is reversible with respect to the standard normal distribution.
The preconditioned Crank–Nicolson algorithm, or pCN algorithm, uses a Gaussian autoregressive proposal reversible with respect to a standard normal distribution in a Metropolis–Hastings algorithm. When the target density is a likelihood times the proposal's invariant Gaussian prior density, the Gaussian factors cancel from the Metropolis–Hastings acceptance probability, leaving the likelihood ratio.
Random-walk Metropolis proposes a symmetric increment from the current state and accepts a proposal from with probability .
A Poisson Metropolis chain samples a Poisson distribution by proposing an upward or downward unit step with equal probability and reflecting a downward proposal at zero into a self-proposal. Its upward and downward transition probabilities are the displayed , with , and the diagonal entry is . For , adjacent stationary fluxes equal . Hence detailed balance holds. Positive adjacent probabilities imply an irreducible Markov chain; implies aperiodicity. The normalized invariant Poisson distribution implies positive recurrence, so the countable-state Markov chain convergence theorem applies. The boundary proposal probability is essential: forcing every proposal at zero to go upward would require a different acceptance ratio.
To update a positive parameter, a symmetric additive proposal distribution can be generated on the whole real line. Reject nonpositive proposals; accept positive ones using the target density ratio. The off-diagonal proposal remains symmetric. Repeatedly redrawing until the proposal is positive instead truncates and renormalizes the proposal differently at different current states, so a Hastings correction is then required. A symmetric walk in is another valid method, but its transformed target includes the Jacobian determinant factor .
A small proposal scale increases acceptance while making successive states almost equal. A large scale often proposes low-density states and creates long rejection runs. A pilot comparison can optimize effective sample size of a Markov chain per unit computing time, or expected accepted squared displacement, rather than acceptance alone. Tune on representative functions and then fix the scale for production; an arbitrarily history-dependent adaptation is not automatically a chain with the desired invariant distribution.
An independence Metropolis–Hastings algorithm proposes from a fixed density independent of the current state. If , it is uniformly and hence geometrically ergodic.
If a Metropolis–Hastings algorithm proposes fresh draws from its target stationary distribution , its acceptance ratio on the positive support is . Therefore every proposal is accepted, and . From the first update onward the recorded states are independent and identically distributed random variables with law , regardless of the initial state in the support. An arbitrary initial state is excluded when claiming an unbiased finite-sample average.
The effective sample size discounts a correlated chain's raw length by its integrated autocorrelation time.
For a stationary Markov chain and a scalar observable with summable autocorrelation function , the asymptotic variance of its sample mean is . Thus the effective sample size of a Markov chain is approximately . Different observables can have very different autocorrelation times.
In a systematic Gibbs sampler for a standardized bivariate normal distribution with correlation , update conditionally on the old , then update using the new . Substitution gives the displayed autoregressive process of order one, with independent noises with the standard normal distribution . The sweep-to-sweep autocorrelation of at lag is , so the chain mixes slowly as approaches one.
For a standard bivariate normal distribution with correlation , each conditional has variance and mean times the other coordinate. A sweep draws , then . The resulting coordinate chain is an AR(1) process with coefficient and innovation variance . It shows explicitly why near-unit correlation slows successive Gibbs sweeps.
Software for Bayesian inference through Markov chain Monte Carlo in directed statistical models. Its model language uses
dnorm(mean, precision), so the second argument is inverse variance; dcat indexes a supplied probability vector, and dbern introduces a binary latent variable. The model is declarative, so the order of deterministic node definitions does not impose procedural evaluation order.For Gaussian precision , a systematic update of the first coordinate followed by the second makes the centered second coordinate an AR(1) chain with coefficient . Independent conditional Gaussian noise supplies its stable innovation. This proves convergence of the Gaussian Gibbs sampler and explains slower mixing when posterior correlation has magnitude near one.
Every full-conditional coordinate update satisfies detailed balance with the target distribution. Their systematic ordered composition preserves the target but need not satisfy detailed balance, since compositions of reversible kernels need not be reversible. A fixed-probability random-scan mixture remains reversible.
A blocked Gibbs sampler draws groups of coordinates jointly from their full conditional distributions. Each update preserves the joint probability distribution; dependence between blocks can still cause a long mixing time.
On a bipartite image graph, the pixels of one color are conditionally independent given the other color. Draw all black pixels from their independent full conditionals, then draw all whites conditional on the new blacks. Each color update preserves the target law, so their composition does too.
A random-scan Gibbs sampler chooses one coordinate, commonly uniformly at random, and redraws it from its complete conditional distribution while leaving all other coordinates fixed. Each coordinate update preserves the target distribution.
A single-coordinate Gibbs sampler update preserves the remaining coordinates and independently redraws the selected coordinate from its full conditional distribution. The joint measure of old and new states factors into a marginal and two identical conditional factors, making it symmetric. A fixed-probability mixture of such kernels therefore satisfies detailed balance.
A tempered Gibbs sampler changes the coordinate-selection probabilities and compensates by drawing from modified complete conditionals. Its invariant law can differ from the desired target, so expectations under the target are recovered with explicit importance weights.
For independent , a flat prior on , and an exponential prior of rate on , the full conditionals areandwhere the gamma distribution is parametrized by shape and rate.
Articles by others on the same topic
Markov Chain Monte Carlo (MCMC) is a class of algorithms used for sampling from probability distributions when direct sampling is challenging. It combines principles from Markov chains and Monte Carlo methods to allow for the estimation of complex distributions, particularly in high-dimensional spaces. ### Key Concepts: 1. **Markov Chain**: A Markov chain is a sequence of random variables where the distribution of the next variable depends only on the current variable and not on the previous states (the Markov property).