Why MCMC Starts From the Unnormalized Posterior

A fundamental idea in Bayesian computation is that most Markov Chain Monte Carlo (MCMC) algorithms do not require the fully normalized posterior distribution.

Instead, they only require the unnormalized posterior density.


1. Bayesian Posterior Distribution

Bayes’ theorem defines the posterior distribution as

\[ p(\theta|y) = \frac{p(y|\theta)p(\theta)} {p(y)}, \]

where

  • \(p(\theta|y)\) is the posterior distribution,
  • \(p(y|\theta)\) is the likelihood,
  • \(p(\theta)\) is the prior distribution,
  • \(p(y)\) is the marginal likelihood.

The denominator is

\[ p(y) = \int p(y|\theta)p(\theta)d\theta. \]

This is the normalizing constant that makes the posterior integrate to one.


2. Why the Normalizing Constant Is Difficult

For simple Bayesian models,

\[ p(y) \]

may be calculated analytically.

However, for complex models,

\[ p(y) = \int p(y|\theta)p(\theta)d\theta \]

is usually impossible to calculate.

For example:

  • hierarchical models,
  • random effects models,
  • Bayesian survival models,
  • Bayesian spatial models,
  • Bayesian machine learning models.

Therefore, we usually only know

\[ p(\theta|y) \propto p(y|\theta)p(\theta). \]

The quantity

\[ \tilde p(\theta) = p(y|\theta)p(\theta) \]

is called the unnormalized posterior.


3. Why Is the Unnormalized Posterior Enough?

The key idea of MCMC is:

MCMC algorithms only need relative probabilities, not absolute probabilities.

Suppose

\[ p(\theta) = C f(\theta), \]

where \(C\) is an unknown constant.

The distribution has the same shape as

\[ f(\theta). \]

Only the vertical scale changes.

MCMC algorithms are designed so that this constant cancels.


4. Metropolis-Hastings Example

The Metropolis-Hastings acceptance probability is

\[ \alpha = \min \left( 1, \frac{p(\theta^*|y)} {p(\theta|y)} \frac{q(\theta|\theta^*)} {q(\theta^*|\theta)} \right). \]

Using Bayes’ theorem,

\[ p(\theta|y) = \frac{p(y|\theta)p(\theta)} {p(y)}, \]

we obtain

\[ \alpha = \min \left( 1, \frac{ \frac{p(y|\theta^*)p(\theta^*)}{p(y)} } { \frac{p(y|\theta)p(\theta)}{p(y)} } \frac{q(\theta|\theta^*)} {q(\theta^*|\theta)} \right). \]

The marginal likelihood cancels:

\[ \alpha = \min \left( 1, \frac{ p(y|\theta^*)p(\theta^*) } { p(y|\theta)p(\theta) } \frac{q(\theta|\theta^*)} {q(\theta^*|\theta)} \right). \]

Therefore,

Metropolis-Hastings only requires

\[ p(y|\theta)p(\theta), \]

the unnormalized posterior.


5. Gibbs Sampling

Gibbs sampling works by sampling from full conditional distributions.

Suppose the joint posterior is

\[ p(\theta_1,\theta_2|y) \propto f(\theta_1,\theta_2). \]

The conditional distribution is

\[ p(\theta_1|\theta_2,y) = \frac{ f(\theta_1,\theta_2) } { \int f(\theta_1,\theta_2)d\theta_1 }. \]

The unknown global normalizing constant does not appear.

Only the conditional distribution is required.


6. Hamiltonian Monte Carlo

Hamiltonian Monte Carlo (HMC) also starts from the unnormalized posterior.

The potential energy is defined as

\[ U(\theta) = -\log p(\theta|y). \]

Since

\[ p(\theta|y) \propto p(y|\theta)p(\theta), \]

we can write

\[ U(\theta) = -\log p(y|\theta) -\log p(\theta) +C. \]

The gradient is

\[ \nabla U(\theta) = -\nabla\log p(y|\theta) -\nabla\log p(\theta). \]

The unknown constant disappears because

\[ \nabla C=0. \]

Therefore, HMC does not need the normalized posterior.


7. Why Add Hamiltonian Dynamics?

The unnormalized posterior gives information about the shape of the distribution.

It tells us:

  • where probability is high,
  • where probability is low,
  • the direction of steepest change.

However, it does not tell us how to efficiently explore the parameter space.

HMC introduces a physical system:

\[ H(\theta,r) = U(\theta)+K(r), \]

where

  • \(U(\theta)\) is potential energy,
  • \(K(r)\) is kinetic energy.

The particle then moves through the posterior landscape according to Hamiltonian dynamics.


8. Complete HMC Flow

The complete logic is:

\[ \boxed{ \begin{aligned} \text{Unnormalized posterior} &\rightarrow p(y|\theta)p(\theta) \\ &\rightarrow \text{Log posterior} \\ &\rightarrow \text{Potential energy} \\ &\rightarrow \text{Add momentum} \\ &\rightarrow \text{Hamiltonian dynamics} \\ &\rightarrow \text{Leapfrog integration} \\ &\rightarrow \text{Metropolis correction} \\ &\rightarrow \text{Posterior samples} \end{aligned} } \]


9. Do All MCMC Algorithms Use the Unnormalized Posterior?

Almost all Bayesian MCMC methods do.

Algorithm Uses unnormalized posterior? Reason
Random Walk Metropolis Yes Acceptance ratio cancels constants
Metropolis-Hastings Yes Ratio of densities
Gibbs Sampling Yes Conditional distributions
Hamiltonian Monte Carlo Yes Gradient removes constants
No-U-Turn Sampler (NUTS) Yes Extension of HMC
Slice Sampling Yes Uses relative density

10. When Is the Normalized Posterior Needed?

The normalizing constant is required for some Bayesian tasks.

Examples:

Bayes Factors

Model comparison requires

\[ p(y|M) \]

which is the marginal likelihood.


Exact Posterior Probabilities

Some calculations require the absolute posterior density.


Model Evidence Estimation

Methods such as:

  • bridge sampling,
  • thermodynamic integration,
  • nested sampling,

estimate the missing normalizing constant.


11. The Main Concept

The fundamental contribution of MCMC is:

We do not need to calculate the posterior distribution completely. We only need to know the relative shape of the posterior, and MCMC constructs a Markov chain whose long-run distribution is the desired posterior.

In practice:

\[ \boxed{ \text{Posterior sampling} \neq \text{Computing the posterior density} } \]

Instead,

\[ \boxed{ \text{Posterior sampling} = \text{Constructing a chain that has the posterior as its equilibrium distribution} } \]

This is why modern Bayesian computation is possible even for very complex models.