Laplace Approximation

Statistics
Introduced by
Pierre-Simon Laplace (1774); Bayesian formalisation: Tierney & Kadane (1986)
Year
1986
Type
Analytical posterior approximation

What does it do?

The Laplace approximation replaces an intractable posterior distribution with a multivariate Gaussian centred at the posterior mode, with the covariance taken from the curvature of the log-posterior at that mode.

Tierney and Kadane (1986) gave its Bayesian formulation for approximating posterior moments and marginal densities, and Rue, Martino and Chopin (2009) built on the idea in Integrated Nested Laplace Approximations (INLA) for latent Gaussian models. It is a deterministic alternative to Markov chain Monte Carlo (MCMC): it requires an optimiser rather than sampling chains.

The intuition behind the method

Think of the log-posterior as a landscape with a single peak at the posterior mode. The Laplace approximation fits a smooth, symmetric bowl (a Gaussian) to the landscape near that peak. Where the curvature is steep the bowl is narrow, so the parameter is pinned down more precisely; where the surface is flat the bowl is wide. The fit is good when the posterior is close to Gaussian, which tends to happen when the likelihood dominates the prior as the sample grows. The fit is poor when the posterior has several peaks, strong skew or heavy tails, because a symmetric bowl fitted at one peak cannot represent those features.

History

The underlying idea of expanding a function around its maximum and approximating it by a Gaussian dates to Pierre-Simon Laplace (1774). Tierney and Kadane (1986) gave a Bayesian version that approximates posterior means, variances and marginal densities by maximising a slightly modified likelihood and evaluating the observed information at the maximum; their abstract notes that the approximate marginal densities behave like saddle-point approximations. Rue, Martino and Chopin (2009) introduced Integrated Nested Laplace Approximations for latent Gaussian models, and the authors report that these give posterior marginals in seconds or minutes where MCMC needed hours or days.

When to use it

Choose the Laplace approximation when you need quick, deterministic posterior summaries and the MAP estimate of your model can be computed reliably by an optimiser. This covers many generalised linear models, such as logistic or Poisson regression. It rests on the following assumptions. (1) The log-posterior is twice differentiable. (2) The mode is an interior maximum, not on a boundary of the parameter space. (3) The Hessian of the log-posterior is negative definite at the mode, so that the covariance is a valid positive-definite matrix; check this before using it. (4) The posterior is approximately unimodal; Tierney and Kadane (1986) state that their principal regularity condition is that likelihood times prior is unimodal. (5) The parameters are on an unconstrained scale (for example log sigma rather than sigma), where a Gaussian shape is more plausible. The method suits posteriors that are not strongly skewed, which is more plausible with larger samples. It is the basis of INLA for latent Gaussian models, including structured additive regression. Do not rely on it for multimodal posteriors, for models with many latent variables where the Hessian is large and dense, or for posteriors with heavy tails. In those cases MCMC, or a method that does not assume local Gaussianity, is safer. If you need the exact posterior, use sampling and check the approximation against it.

Limitations and considerations

  • The Gaussian is symmetric and unimodal by construction, so skewed, heavy-tailed or multimodal posteriors are misrepresented. Tierney and Kadane (1986) state that their principal regularity condition is that likelihood times prior is unimodal.
  • Dense Hessian inversion costs O(p³), so high-dimensional models without sparse curvature become impractical.
  • On a non-concave log-posterior the mode search may find a local maximum, and the whole approximation is then centred in the wrong place.
  • The method does not report how far its answer is from the true posterior; accuracy has to be judged by comparison with another method on test cases.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Deterministic: repeated runs on the same data give the same answer, and there are no chains to thin or convergence traces to monitor.
  • Gives an analytic estimate of the log marginal likelihood from quantities already computed, which supports model comparison and empirical Bayes tuning of hyperparameters.
  • With a sparse Hessian the cost is much lower than for a dense one, and the same idea underlies INLA for latent Gaussian models.
  • Needs only a mode finder and the second derivatives of the log-posterior, so implementations are comparatively simple.

Applications

  • Generalised linear mixed models, where approximate inference for random effects can replace sampling.
  • Latent Gaussian models fitted with INLA, including the structured additive, spatial, spatiotemporal, state space and log-Gaussian Cox process models listed by Rue et al. (2009).
  • Bayesian neural networks, where a Gaussian approximation to the weight posterior gives approximate uncertainty estimates (a common use in general practice).
  • Nonlinear mixed-effects models, where Laplace-type approximations are commonly used for the marginal likelihood (a common use in general practice).
  • Empirical Bayes tuning of hyperparameters, maximising the approximated marginal likelihood instead of running nested MCMC.

How it works

How it works

1

The posterior mode, the parameter value that maximises the log-posterior, is found by numerical optimisation. The log-posterior is the sum of the log-likelihood and the log-prior, so the prior enters the optimisation directly. In high-dimensional problems this search is usually the most costly step. On a non-concave surface the optimiser may stop at a local maximum rather than the global one.

Formula
\hat{\theta} = \arg\max_{\theta}\, \log p(\theta \mid y) = \arg\max_{\theta}\bigl[\log p(y \mid \theta) + \log p(\theta)\bigr]
2

The negative Hessian of the log-posterior, the matrix of second derivatives, is evaluated at the mode. It measures the local curvature, and its inverse is used as the covariance of the Gaussian approximation. Inverting a p×p matrix costs O(p³) operations. This is manageable for low to moderate p, but it becomes the bottleneck for large dense models unless the Hessian has useful sparsity.

Formula
\Sigma^{-1} = -\nabla^2 \log p(\theta \mid y)\big|_{\theta = \hat{\theta}}
3

The posterior is approximated by a multivariate normal with mean at the mode and covariance equal to the inverse negative Hessian. Means, variances and credible intervals can be read from this Gaussian without drawing samples. Because the Gaussian is symmetric about the mode, it cannot reproduce skewness in the true posterior.

Formula
p(\theta \mid y) \approx \mathcal{N}\!\left(\hat{\theta},\; \Sigma\right)
4

The normalising constant of the Gaussian approximation gives an analytic estimate of the log marginal likelihood (log model evidence). The formula adds the log-likelihood and log-prior at the mode, a term (p/2)log(2π), and minus half the log-determinant of the negative Hessian. This value is used for model comparison and for empirical Bayes tuning of hyperparameters. It is an approximation to the evidence, not the exact value.

Formula
\log p(y) \approx \log p(y \mid \hat{\theta}) + \log p(\hat{\theta}) + \tfrac{p}{2}\log(2\pi) - \tfrac{1}{2}\log\det\!\left(-\nabla^2 \log p(\theta \mid y)\big|_{\hat{\theta}}\right)

Common pitfalls

  • Using the approximation without checking it. Compare the summaries with MCMC on a small or simulated dataset, and inspect whether the marginals look roughly Gaussian.
  • Running one optimisation from a single starting value on a multimodal posterior. The result then reflects the starting point rather than the posterior.
  • Ignoring parameterisation. The Gaussian fit is not invariant to reparameterisation, so an interval for a variance or scale parameter can look very different on the natural scale and on the log scale. Fit on an unconstrained scale (for example log sigma or logit p) and transform the interval back, or report summaries on the scale where the posterior is closest to Gaussian.
  • Expecting symmetric credible intervals to be correct for skewed parameters. The basic approximation is symmetric. Tierney and Kadane (1986) describe more accurate approximations of marginal densities, and Rue et al. (2009) describe a full and a simplified INLA version; consider these when skewness matters.
  • Using the Gaussian summaries without checking that the Hessian at the mode is negative definite. If it is not, the optimiser has not reached a proper maximum and the covariance is invalid.
  • Treating the approximated log marginal likelihood as exact when comparing models with little data or with poorly concentrated posteriors, where the approximation error can be material.

Frequently asked questions

How does the Laplace approximation differ from variational Bayes?

Both are deterministic approximations to the posterior, but they differ in what they optimise. The Laplace approximation fits a Gaussian by matching the location and curvature at the posterior mode. Variational Bayes chooses a distribution from a family by minimising the KL divergence to the true posterior (equivalently, maximising the evidence lower bound). The Laplace approximation is simpler and requires only second-order derivatives, whereas mean-field variational Bayes can be applied to models where computing the Hessian is impractical but tends to underestimate posterior variance.

When is the Laplace approximation exact?

The approximation is exact when the true posterior is itself a multivariate Gaussian — for example, in a linear Gaussian model with a Gaussian prior on coefficients. More generally, by a Bernstein–von Mises theorem argument, the approximation becomes increasingly accurate as sample size grows, because the likelihood dominates the prior and the posterior concentrates into an approximately Gaussian shape around the MLE.

What is INLA and how does it relate to the Laplace approximation?

Integrated Nested Laplace Approximations (INLA), introduced by Rue, Martino, and Chopin (2009), is an inference framework for latent Gaussian models: a Gaussian latent field controlled by a few hyperparameters, with non-Gaussian responses. It uses the Laplace approximation to approximate the conditional posterior of the latent field and the marginal posteriors of the hyperparameters, then integrates over the hyperparameter space numerically. The Rue et al. abstract reports posterior marginals in seconds or minutes, where MCMC needed hours or days. It is implemented in the R-INLA package.

Can I use the Laplace approximation for model comparison?

Yes. The log marginal likelihood approximated by the Laplace method can be used to compute Bayes factors or to select among competing models. The approximation is most reliable when the posterior is well concentrated and approximately Gaussian. For small samples or complex posteriors, check the comparison against cross-validation or against marginal likelihood estimates obtained by other methods, such as MCMC-based estimators.

Related methods

Sources

  1. Tierney, L. & Kadane, J. B. (1986). Accurate approximations for posterior moments and marginal densities. Journal of the American Statistical Association, 81(393), 82–86.

    Open DOI reference
  2. MacKay, D. J. C. (2003). Information Theory, Inference, and Learning Algorithms. Cambridge University Press.

    ISBN: 978-0521642989
  3. Rue, H., Martino, S. & Chopin, N. (2009). Approximate Bayesian inference for latent Gaussian models by using integrated nested Laplace approximations. Journal of the Royal Statistical Society: Series B, 71(2), 319–392.

    Open DOI reference