Laplace's method

From HandWiki
Short description: Method for approximate evaluation of integrals


In mathematics, Laplace's method, named after Pierre-Simon Laplace, is a technique used to approximate integrals of the form

abeMf(x)dx,

where f(x) is a twice-differentiable function, M is a large number, and the endpoints a and b could possibly be infinite. This technique was originally presented in (Laplace 1774).

In Bayesian statistics, Laplace's approximation can refer to either approximating the posterior normalizing constant with Laplace's method[1] or approximating the posterior distribution with a Gaussian centered at the maximum a posteriori estimate.[2] Laplace approximations play a central role in the integrated nested Laplace approximations method for fast approximate Bayesian inference.

The idea of Laplace's method

f(x)=sin(x)x has a global maximum at 0. eMf(x) is shown on top for M = 0.5, and at the bottom for M = 3 (both in blue). As M grows the approximation of this function by a Gaussian function (shown in red) improves. This observation underlies Laplace's method.

Suppose the function f(x) has a unique global maximum at x0. Let M>0 be a constant and consider the following two functions:

g(x)=Mf(x)h(x)=eMf(x)

Note that x0 will be the global maximum of g and h as well. Now observe:

g(x0)g(x)=Mf(x0)Mf(x)=f(x0)f(x)h(x0)h(x)=eMf(x0)eMf(x)=eM(f(x0)f(x))

As M increases, the ratio for h will grow exponentially, while the ratio for g does not change. Thus, significant contributions to the integral of this function will come only from points x in a neighbourhood of x0, which can then be estimated.

General theory of Laplace's method

To state and motivate the method, we need several assumptions. We will assume that x0 is not an endpoint of the interval of integration, that the values f(x) cannot be very close to f(x0) unless x is close to x0.

We can expand f(x) around x0 by Taylor's theorem,

f(x)=f(x0)+f(x0)(xx0)+12f(x0)(xx0)2+R

where R=O((xx0)3) (see: big O notation).

Since f has a global maximum at x0, and since x0 is not an endpoint, it is a stationary point, i.e. f(x0)=0. Therefore, the second-order Taylor polynomial approximating f(x) is

f(x)f(x0)+12f(x0)(xx0)2

Then we just need one more step to get our Gaussian distribution. Since x0 is a global maximum of the function f we can say, by definition of the second derivative, that f(x0)<0, thus allowing us to write

f(x)f(x0)12|f(x0)|(xx0)2

for x close to x0. The integral can then be approximated with:

abeMf(x)dxeMf(x0)abe12M|f(x0)|(xx0)2dx

(see the picture on the right). This latter integral is a Gaussian integral if the limits of integration go from −∞ to +∞ (which can be assumed because the exponential decays very fast away from x0), and thus it can be calculated. We find

abeMf(x)dx2πM|f(x0)|eMf(x0) as M.

A generalization of this method and extension to arbitrary precision is provided by (Fog 2008).

Formal statement and proof

Suppose f(x) is a twice continuously differentiable function on [a,b], and there exists a unique point x0(a,b) such that:

f(x0)=maxx[a,b]f(x)andf(x0)<0.

Then:

limnabenf(x)dxenf(x0)2πn(f(x0))=1.
Proof

Lower bound: Let ε>0. Since f is continuous there exists δ>0 such that if |x0c|<δ then f(c)f(x0)ε. By Taylor's Theorem, for any x(x0δ,x0+δ),

f(x)f(x0)+12(f(x0)ε)(xx0)2.

Then we have the following lower bound:

abenf(x)dxx0δx0+δenf(x)dxenf(x0)x0δx0+δen2(f(x0)ε)(xx0)2dx=enf(x0)1n(f(x0)+ε)δn(f(x0)+ε)δn(f(x0)+ε)e12y2dy

where the last equality was obtained by a change of variables

y=n(f(x0)+ε)(xx0).

Remember f(x0)<0 so we can take the square root of its negation.

If we divide both sides of the above inequality by

enf(x0)2πn(f(x0))

and take the limit we get:

limnabenf(x)dxenf(x0)2πn(f(x0))limn12πδn(f(x0)+ε)δn(f(x0)+ε)e12y2dyf(x0)f(x0)+ε=f(x0)f(x0)+ε

since this is true for arbitrary ε we get the lower bound:

limnabenf(x)dxenf(x0)2πn(f(x0))1

Note that this proof works also when a= or b= (or both).

Upper bound: The proof is similar to that of the lower bound but there are a few inconveniences. Again we start by picking an ε>0 but in order for the proof to work we need ε small enough so that f(x0)+ε<0. Then, as above, by continuity of f and Taylor's Theorem we can find δ>0 so that if |xx0|<δ, then

f(x)f(x0)+12(f(x0)+ε)(xx0)2.

Lastly, by our assumptions (assuming a,b are finite) there exists an η>0 such that if |xx0|δ, then f(x)f(x0)η.

Then we can calculate the following upper bound:

abenf(x)dxax0δenf(x)dx+x0δx0+δenf(x)dx+x0+δbenf(x)dx(ba)en(f(x0)η)+x0δx0+δenf(x)dx(ba)en(f(x0)η)+enf(x0)x0δx0+δen2(f(x0)+ε)(xx0)2dx(ba)en(f(x0)η)+enf(x0)+en2(f(x0)+ε)(xx0)2dx(ba)en(f(x0)η)+enf(x0)2πn(f(x0)ε)

If we divide both sides of the above inequality by

enf(x0)2πn(f(x0))

and take the limit we get:

limnabenf(x)dxenf(x0)2πn(f(x0))limn(ba)eηnn(f(x0))2π+f(x0)f(x0)ε=f(x0)f(x0)ε

Since ε is arbitrary we get the upper bound:

limnabenf(x)dxenf(x0)2πn(f(x0))1

And combining this with the lower bound gives the result.

Note that the above proof obviously fails when a= or b= (or both). To deal with these cases, we need some extra assumptions. A sufficient (not necessary) assumption is that for n=1,

abenf(x)dx<,

and that the number η as above exists (note that this must be an assumption in the case when the interval [a,b] is infinite). The proof proceeds otherwise as above, but with a slightly different approximation of integrals:

ax0δenf(x)dx+x0+δbenf(x)dxabef(x)e(n1)(f(x0)η)dx=e(n1)(f(x0)η)abef(x)dx.

When we divide by

enf(x0)2πn(f(x0)),

we get for this term

e(n1)(f(x0)η)abef(x)dxenf(x0)2πn(f(x0))=e(n1)ηnef(x0)abef(x)dxf(x0)2π

whose limit as n is 0. The rest of the proof (the analysis of the interesting term) proceeds as above.

The given condition in the infinite interval case is, as said above, sufficient but not necessary. However, the condition is fulfilled in many, if not in most, applications: the condition simply says that the integral we are studying must be well-defined (not infinite) and that the maximum of the function at x0 must be a "true" maximum (the number η>0 must exist). There is no need to demand that the integral is finite for n=1 but it is enough to demand that the integral is finite for some n=N.

This method relies on 4 basic concepts such as

Concepts
1. Relative error

The “approximation” in this method is related to the relative error and not the absolute error. Therefore, if we set

s=2πM|f(x0)|.

the integral can be written as

abeMf(x)dx=seMf(x0)1sabeM(f(x)f(x0))dx=seMf(x0)ax0sbx0seM(f(sy+x0)f(x0))dy

where s is a small number when M is a large number obviously and the relative error will be

|ax0sbx0seM(f(sy+x0)f(x0))dy1|.

Now, let us separate this integral into two parts: y[Dy,Dy] region and the rest.

2. eM(f(sy+x0)f(x0))eπy2 around the stationary point when M is large enough

Let’s look at the Taylor expansion of M(f(x)f(x0)) around x0 and translate x to y because we do the comparison in y-space, we will get

M(f(x)f(x0))=Mf(x0)2s2y2+Mf(x0)6s3y3+=πy2+O(1M).

Note that f(x0)=0 because x0 is a stationary point. From this equation you will find that the terms higher than second derivative in this Taylor expansion is suppressed as the order of 1M so that exp(M(f(x)f(x0))) will get closer to the Gaussian function as shown in figure. Besides,

eπy2dy=1.
The figure of eM[f(sy+x0)f(x0)] with M equals 1, 2 and 3, and the red line is the curve of function eπy2 .
3. The larger M is, the smaller range of x is related

Because we do the comparison in y-space, y is fixed in y[Dy,Dy] which will cause x[sDy,sDy]; however, s is inversely proportional to M, the chosen region of x will be smaller when M is increased.

4. If the integral in Laplace’s method converges, the contribution of the region which is not around the stationary point of the integration of its relative error will tend to zero as M grows.

Relying on the 3rd concept, even if we choose a very large Dy, sDy will finally be a very small number when M is increased to a huge number. Then, how can we guarantee the integral of the rest will tend to 0 when M is large enough?

The basic idea is to find a function m(x) such that m(x)f(x) and the integral of eMm(x) will tend to zero when M grows. Because the exponential function of Mm(x) will be always larger than zero as long as m(x) is a real number, and this exponential function is proportional to m(x), the integral of eMf(x) will tend to zero. For simplicity, choose m(x) as a tangent through the point x=sDy as shown in the figure:

m(x) is denoted by the two tangent lines passing through x=±sDy+x0. When sDy gets smaller, the cover region will be larger.

If the interval of the integration of this method is finite, we will find that no matter f(x) is continue in the rest region, it will be always smaller than m(x) shown above when M is large enough. By the way, it will be proved later that the integral of eMm(x) will tend to zero when M is large enough.

If the interval of the integration of this method is infinite, m(x) and f(x) might always cross to each other. If so, we cannot guarantee that the integral of eMf(x) will tend to zero finally. For example, in the case of f(x)=sin(x)x, 0eMf(x)dx will always diverge. Therefore, we need to require that deMf(x)dx can converge for the infinite interval case. If so, this integral will tend to zero when d is large enough and we can choose this d as the cross of m(x) and f(x).

You might ask that why not choose def(x)dx as a convergent integral? Let me use an example to show you the reason. Suppose the rest part of f(x) is lnx, then ef(x)=1x and its integral will diverge; however, when M=2, the integral of eMf(x)=1x2 converges. So, the integral of some functions will diverge when M is not a large number, but they will converge when M is large enough.

Based on these four concepts, we can derive the relative error of this Laplace's method.

Other formulations

Laplace's approximation is sometimes written as

abh(x)eMg(x)dx2πM|g(x0)|h(x0)eMg(x0)  as M

where h is positive.

Importantly, the accuracy of the approximation depends on the variable of integration, that is, on what stays in g(x) and what goes into h(x).[3]

The derivation of its relative error

First, use x0=0 to denote the global maximum, which will simplify this derivation. We are interested in the relative error, written as |R|,

abh(x)eMg(x)dx=h(0)eMg(0)sa/sb/sh(x)h(0)eM[g(sy)g(0)]dy1+R,

where

s2πM|g(0)|.

So, if we let

Ah(sy)h(0)eM[g(sy)g(0)]

and A0eπy2, we can get

|R|=|a/sb/sAdyA0dy|

since A0dy=1.

For the upper bound, note that |A+B||A|+|B|, thus we can separate this integration into 5 parts with 3 different types (a), (b) and (c), respectively. Therefore,

|R|<|DyA0dy|(a1)+|Dyb/sAdy|(b1)+|DyDy(AA0)dy|(c)+|a/sDyAdy|(b2)+|DyA0dy|(a2)

where (a1) and (a2) are similar, let us just calculate (a1) and (b1) and (b2) are similar, too, I’ll just calculate (b1).

For (a1), after the translation of zπy2, we can get

(a1)=|12ππDy2ezz1/2dz|<eπDy22πDy.

This means that as long as Dy is large enough, it will tend to zero.

For (b1), we can get

(b1)|Dyb/s[h(sy)h(0)]maxeMm(sy)dy|

where

m(x)g(x)g(0)asx[sDy,b]

and h(x) should have the same sign of h(0) during this region. Let us choose m(x) as the tangent across the point at x=sDy , i.e. m(sy)=g(sDy)g(0)+g(sDy)(sysDy) which is shown in the figure

m(x) is the tangent lines across the point at x=sDy .

From this figure you can find that when s or Dy gets smaller, the region satisfies the above inequality will get larger. Therefore, if we want to find a suitable m(x) to cover the whole f(x) during the interval of (b1), Dy will have an upper limit. Besides, because the integration of eαx is simple, let me use it to estimate the relative error contributed by this (b1).

Based on Taylor expansion, we can get

M[g(sDy)g(0)]=M[g(0)2s2Dy2+g(ξ)6s3Dy3]as ξ[0,sDy]=πDy2+(2π)3/2g(ξ)Dy36M|g(0)|32,

and

Msg(sDy)=Ms(g(0)sDy+g(ζ)2s2Dy2)as ζ[0,sDy]=2πDy+2M(π|g(0)|)32g(ζ)Dy2,

and then substitute them back into the calculation of (b1); however, you can find that the remainders of these two expansions are both inversely proportional to the square root of M, let me drop them out to beautify the calculation. Keeping them is better, but it will make the formula uglier.

(b1)|[h(sy)h(0)]maxeπDy20b/sDye2πDyydy||[h(sy)h(0)]maxeπDy212πDy|.

Therefore, it will tend to zero when Dy gets larger, but don't forget that the upper bound of Dy should be considered during this calculation.

About the integration near x=0, we can also use Taylor's Theorem to calculate it. When h(0)0

(c)DyDyeπy2|sh(ξ)h(0)y|dy<2πM|g(0)||h(ξ)h(0)|max(1eπDy2)

and you can find that it is inversely proportional to the square root of M. In fact, (c) will have the same behave when h(x) is a constant.

Conclusively, the integral near the stationary point will get smaller as M gets larger, and the rest parts will tend to zero as long as Dy is large enough; however, we need to remember that Dy has an upper limit which is decided by whether the function m(x) is always larger than g(x)g(0) in the rest region. However, as long as we can find one m(x) satisfying this condition, the upper bound of Dy can be chosen as directly proportional to M since m(x) is a tangent across the point of g(x)g(0) at x=sDy. So, the bigger M is, the bigger Dy can be.

In the multivariate case where 𝐱 is a d-dimensional vector and f(𝐱) is a scalar function of 𝐱, Laplace's approximation is usually written as:

h(𝐱)eMf(𝐱)d𝐱(2πM)d/2h(𝐱0)eMf(𝐱0)|H(f)(𝐱0)|1/2 as M

where H(f)(𝐱0) is the Hessian matrix of f evaluated at 𝐱0 and where || denotes matrix determinant. Analogously to the univariate case, the Hessian is required to be negative definite.[4]

By the way, although 𝐱 denotes a d-dimensional vector, the term d𝐱 denotes an infinitesimal volume here, i.e. d𝐱:=dx1dx2dxd.

Laplace's method extension: Steepest descent

Main page: Method of steepest descent

In extensions of Laplace's method, complex analysis, and in particular Cauchy's integral formula, is used to find a contour of steepest descent for an (asymptotically with large M) equivalent integral, expressed as a line integral. In particular, if no point x0 where the derivative of f vanishes exists on the real line, it may be necessary to deform the integration contour to an optimal one, where the above analysis will be possible. Again the main idea is to reduce, at least asymptotically, the calculation of the given integral to that of a simpler integral that can be explicitly evaluated. See the book of Erdelyi (1956) for a simple discussion (where the method is termed steepest descents).

The appropriate formulation for the complex z-plane is

abeMf(z)dz2πMf(z0)eMf(z0) as M.

for a path passing through the saddle point at z0. Note the explicit appearance of a minus sign to indicate the direction of the second derivative: one must not take the modulus. Also note that if the integrand is meromorphic, one may have to add residues corresponding to poles traversed while deforming the contour (see for example section 3 of Okounkov's paper Symmetric functions and random partitions).

Further generalizations

An extension of the steepest descent method is the so-called nonlinear stationary phase/steepest descent method. Here, instead of integrals, one needs to evaluate asymptotically solutions of Riemann–Hilbert factorization problems.

Given a contour C in the complex sphere, a function f defined on that contour and a special point, say infinity, one seeks a function M holomorphic away from the contour C, with prescribed jump across C, and with a given normalization at infinity. If f and hence M are matrices rather than scalars this is a problem that in general does not admit an explicit solution.

An asymptotic evaluation is then possible along the lines of the linear stationary phase/steepest descent method. The idea is to reduce asymptotically the solution of the given Riemann–Hilbert problem to that of a simpler, explicitly solvable, Riemann–Hilbert problem. Cauchy's theorem is used to justify deformations of the jump contour.

The nonlinear stationary phase was introduced by Deift and Zhou in 1993, based on earlier work of Its. A (properly speaking) nonlinear steepest descent method was introduced by Kamvissis, K. McLaughlin and P. Miller in 2003, based on previous work of Lax, Levermore, Deift, Venakides and Zhou. As in the linear case, "steepest descent contours" solve a min-max problem. In the nonlinear case they turn out to be "S-curves" (defined in a different context back in the 80s by Stahl, Gonchar and Rakhmanov).

The nonlinear stationary phase/steepest descent method has applications to the theory of soliton equations and integrable models, random matrices and combinatorics.

Laplace's method generalization: Median-point approximation

In the generalization, evaluation of the integral is considered equivalent to finding the norm of the distribution with density

eMf(x).

Denoting the cumulative distribution F(x), if there is a diffeomorphic Gaussian distribution with density

egγ2y2

the norm is given by

2πγ1eg

and the corresponding diffeomorphism is

y(x)=1γΦ1(F(x)F()),

where Φ denotes cumulative standard normal distribution function.

In general, any distribution diffeomorphic to the Gaussian distribution has density

egγ2y2(x)y(x)

and the median-point is mapped to the median of the Gaussian distribution. Matching the logarithm of the density functions and their derivatives at the median point up to a given order yields a system of equations that determine the approximate values of γ and g.

The approximation was introduced in 2019 by D. Makogon and C. Morais Smith primarily in the context of partition function evaluation for a system of interacting fermions.[5]

Complex integrals

For complex integrals in the form:

12πicic+ig(s)estds

with t1, we make the substitution t = iu and the change of variable s=c+ix to get the bilateral Laplace transform:

12πg(c+ix)euxeicudx.

We then split g(c + ix) in its real and complex part, after which we recover u = t/i. This is useful for inverse Laplace transforms, the Perron formula and complex integration.

Example: Stirling's approximation

Laplace's method can be used to derive Stirling's approximation

N!2πNNNeN

for a large integer N.

From the definition of the Gamma function, we have

N!=Γ(N+1)=0exxNdx.

Now we change variables, letting x=Nz so that dx=Ndz. Plug these values back in to obtain

N!=0eNz(Nz)NNdz=NN+10eNzzNdz=NN+10eNzeNlnzdz=NN+10eN(lnzz)dz.

This integral has the form necessary for Laplace's method with

f(z)=lnzz

which is twice-differentiable:

f(z)=1z1,
f(z)=1z2.

The maximum of f(z) lies at z0 = 1, and the second derivative of f(z) has the value −1 at this point. Therefore, we obtain

N!NN+12πNeN=2πNNNeN.

See also

Notes

  1. Tierney, Luke; Kadane, Joseph B. (1986). "Accurate Approximations for Posterior Moments and Marginal Densities". J. Amer. Statist. Assoc. 81 (393): 82–86. doi:10.1080/01621459.1986.10478240. 
  2. Amaral Turkman, M. Antónia; Paulino, Carlos Daniel; Müller, Peter (2019). "Methods Based on Analytic Approximations". Computational Bayesian Statistics: An Introduction. Cambridge University Press. pp. 150–171. ISBN 978-1-108-70374-1. 
  3. Butler, Ronald W (2007). Saddlepoint approximations and applications. Cambridge University Press. ISBN 978-0-521-87250-8. 
  4. MacKay, David J. C. (September 2003). Information Theory, Inference and Learning Algorithms. Cambridge: Cambridge University Press. ISBN 9780521642989. http://www.inference.phy.cam.ac.uk/mackay/itila/book.html. 
  5. Makogon, D.; Morais Smith, C. (2022-05-03). "Median-point approximation and its application for the study of fermionic systems". Physical Review B 105 (17): 174505. doi:10.1103/PhysRevB.105.174505. https://link.aps.org/doi/10.1103/PhysRevB.105.174505. 

References

  • Azevedo-Filho, A.; Shachter, R. (1994), "Laplace's Method Approximations for Probabilistic Inference in Belief Networks with Continuous Variables", in Mantaras, R.; Poole, D., Uncertainty in Artificial Intelligence, San Francisco, CA: Morgan Kaufmann .
  • Deift, P.; Zhou, X. (1993), "A steepest descent method for oscillatory Riemann–Hilbert problems. Asymptotics for the MKdV equation", Ann. of Math. 137 (2): 295–368, doi:10.2307/2946540 .
  • Erdelyi, A. (1956), Asymptotic Expansions, Dover .
  • Fog, A. (2008), "Calculation Methods for Wallenius' Noncentral Hypergeometric Distribution", Communications in Statistics, Simulation and Computation 37 (2): 258–273, doi:10.1080/03610910701790269 .
  • Laplace, P S (1774), "Mémoires de Mathématique et de Physique, Tome Sixième", Statistical Science 1 (3): 366–367 
  • Wang, Xiang-Sheng; Wong, Roderick (2007). "Discrete analogues of Laplace's approximation". Asymptot. Anal. 54 (3–4): 165–180.