Tutorials › Econometrics (Graduate) › Quasi-Monte Carlo Integration

Simulation-Based Estimation · Tutorial 896 of 952

Quasi-Monte Carlo Integration

Learn how low-discrepancy designs approximate likelihood integrals and how randomized quasi-Monte Carlo makes their numerical error assessable.

Advanced 12 min read

What You'll Learn

  • Transform latent-variable likelihood integrals into integrals over a unit cube.
  • Explain how low discrepancy differs from pseudorandom sampling.
  • Apply a quasi-Monte Carlo point set to a likelihood integral.
  • Use independent randomizations to estimate numerical error.
  • Compare quasi-Monte Carlo with pseudorandom integration and recognize when it may not help.

Why Use Quasi-Monte Carlo?

Likelihoods for models with latent variables often require integration over quantities that are not observed. When the integral has no convenient analytic form, simulation-based integration provides a numerical approximation. Ordinary Monte Carlo uses pseudorandom draws; quasi-Monte Carlo (QMC) instead uses points chosen to cover the integration region evenly. This regular coverage can reduce integration error, particularly when the integrand is reasonably smooth and the effective dimension is modest.

The method is not guaranteed to outperform pseudorandom simulation for every integrand or sample size. Its value depends on the shape of the integrand, the way latent variables are transformed, and the dimension of the integration problem. A useful implementation therefore treats QMC as a numerical design whose accuracy must be assessed, rather than as a guarantee of precision.

From a Likelihood Integral to a Unit Cube

Suppose an observed outcome \(y\) has conditional likelihood \(p(y\mid z,\theta)\) given a latent variable \(Z=z\), whose density is \(f(z\mid\theta)\). The likelihood contribution after integrating out the latent variable is

$$ L(\theta)=\int p(y\mid z,\theta)f(z\mid\theta)\,dz. $$

If \(Z\) has a continuous cumulative distribution function \(F_\theta\), the probability integral transform gives \(Z=F_\theta^{-1}(U)\) for \(U\) uniform on \([0,1]\). Thus the same contribution can be written as an integral over a fixed unit interval. For a \(d\)-dimensional latent vector, a suitable transformation \(T_\theta\) similarly gives

$$ L(\theta)=\int_{[0,1]^d} h_\theta(u)\,du, \qquad h_\theta(u)=p\bigl(y\mid T_\theta(u),\theta\bigr). $$

The transformation must reproduce the latent-variable distribution in the original integral. If the transformation instead defines a proposal distribution, the corresponding likelihood weights must also be included; omitting them changes the integral. The earlier material on importance sampling for likelihood integrals treats that weighted alternative.

Definition: A quasi-Monte Carlo estimate of an integral \(I=\int_{[0,1]^d}h(u)\,du\) uses a set of \(N\) points \(u_1,\ldots,u_N\) designed to cover the unit cube evenly: $$ \widehat I_{\mathrm{QMC}}=\frac{1}{N}\sum_{j=1}^{N}h(u_j). $$ The points are not independent pseudorandom draws. Low-discrepancy sequences, such as Sobol sequences, are designed so that their point sets have relatively small gaps and clusters across the cube.

Discrepancy and the QMC Error Principle

For a point set, star discrepancy measures how far its empirical coverage of axis-aligned boxes \([0,t_1]\times\cdots\times[0,t_d]\) differs from the volume of those boxes. Low discrepancy means that this difference is small over the collection of such boxes. It captures a geometric property of the points, not a measure of the likelihood integrand itself.

The Koksma–Hlawka inequality connects that geometric property to integration error. For a function \(h\) of bounded Hardy–Krause variation \(V_{\mathrm{HK}}(h)\), it states

$$ \left|\frac{1}{N}\sum_{j=1}^{N}h(u_j)-\int_{[0,1]^d}h(u)\,du\right| \leq V_{\mathrm{HK}}(h)D_N^*, $$

where \(D_N^*\) is the star discrepancy of the point set. The inequality explains the basic QMC idea: an evenly covering design can give a small error when the transformed integrand also has manageable variation. For fixed dimension, well-known low-discrepancy sequences have discrepancy of order \((\log N)^d/N\), up to constants. This is a theoretical bound, not usually a practical error estimate: the variation can be hard to calculate, and the bound can be loose. In higher dimensions, the constants and the factor involving dimension can matter greatly.

Worked Likelihood Integrals

Worked Example: A One-Dimensional Latent-Variable Likelihood

Suppose a hypothetical binary outcome is \(y=1\), and its conditional probability given a latent \(U\sim\mathrm{Uniform}(0,1)\) is \(P(y=1\mid U=u)=0.2+0.6u\). The marginal likelihood contribution is the integral of this conditional probability over the latent distribution.

$$ L=\int_0^1(0.2+0.6u)\,du =0.2+0.6\left(\frac{1}{2}\right) =0.5. $$

For illustration, take the four evenly spaced interior points \(u_j=(j-0.5)/4\), giving \(0.125,0.375,0.625,0.875\). The corresponding likelihood values are \(0.275,0.425,0.575,0.725\). Therefore,

$$ \widehat L_{\mathrm{QMC}} =\frac{0.275+0.425+0.575+0.725}{4} =\frac{2.000}{4} =0.500. $$

Here the estimate equals the exact answer because the integrand is linear and the points are symmetric about \(0.5\). That is a feature of this simple example, not a guarantee that a four-point design will integrate general likelihoods exactly.

Worked Example: A Two-Dimensional Likelihood Integral

Consider a hypothetical likelihood contribution with two independent uniform latent variables \(U_1,U_2\). Suppose the conditional likelihood is \(h(u_1,u_2)=(0.1+0.4u_1)(0.2+0.5u_2)\). Independence and uniformity give the exact value

$$ L=\left(\int_0^1(0.1+0.4u_1)\,du_1\right) \left(\int_0^1(0.2+0.5u_2)\,du_2\right) =(0.3)(0.45)=0.135. $$

Use the following illustrative four-point design in the unit square: \((0.125,0.25)\), \((0.375,0.75)\), \((0.625,0.125)\), and \((0.875,0.625)\). At these points, the integrand values are respectively

$$ \begin{aligned} h(0.125,0.25)&=(0.15)(0.325)=0.04875,\\ h(0.375,0.75)&=(0.25)(0.575)=0.14375,\\ h(0.625,0.125)&=(0.35)(0.2625)=0.091875,\\ h(0.875,0.625)&=(0.45)(0.5125)=0.230625. \end{aligned} $$

The resulting approximation is

$$ \widehat L_{\mathrm{QMC}} =\frac{0.04875+0.14375+0.091875+0.230625}{4} =\frac{0.515}{4} =0.12875. $$

This is \(0.00625\) below the exact likelihood contribution. The example shows the calculation for a space-filling design; the four points are illustrative and are not a claim that every standard low-discrepancy sequence would give this exact estimate. In applications, designs such as Sobol sequences are generated by a defined algorithm, and performance depends on the integrand as well as on coverage.

Randomized QMC and Error Assessment

A deterministic QMC estimate is reproducible, but it does not provide a standard Monte Carlo standard error from the variation of independent draws: the points were not independent draws. A common solution is randomized QMC. A valid randomization, such as a suitable scramble of a low-discrepancy sequence, preserves its space-filling structure while making the randomized estimate unbiased. Generate \(R\) independent randomizations, each with \(N\) points, and compute one estimate \(\widehat I_r\) from each.

If each randomized point is uniform on the unit cube, linearity of expectation gives the unbiasedness justification:

$$ E(\widehat I_r) =E\left[\frac{1}{N}\sum_{j=1}^{N}h(U_{rj})\right] =\frac{1}{N}\sum_{j=1}^{N}E\{h(U_{rj})\} =\int_{[0,1]^d}h(u)\,du. $$

The points within one randomized design can be dependent; independence between the \(R\) randomizations is what supports estimating the variation across replicate estimates. Let \(\bar I_R\) be the mean of those estimates and \(s_R\) their sample standard deviation. The estimated standard error of their mean is \(s_R/\sqrt{R}\). This measures numerical variability under the chosen randomized design. It does not measure uncertainty from sampling the observed data.

Worked Example: Estimating QMC Numerical Error

Suppose five independent scrambles, each using the same number of points, produce hypothetical likelihood estimates \(0.132, 0.138, 0.129, 0.136,\) and \(0.135\). Their mean is

$$ \bar I_R=\frac{0.132+0.138+0.129+0.136+0.135}{5} =\frac{0.670}{5}=0.134. $$

The deviations from the mean are \(-0.002,0.004,-0.005,0.002,\) and \(0.001\). The squared deviations sum to \(0.000050\), so the replicate standard deviation and standard error are

$$ s_R=\sqrt{\frac{0.000050}{5-1}}=0.003536, \qquad SE(\bar I_R)=\frac{0.003536}{\sqrt{5}}=0.001581. $$

The estimated numerical standard error of the averaged estimate is therefore about \(0.00158\). With only five replicates, that estimate is itself imprecise. If an approximate interval is useful and the replicate estimates are reasonably well behaved, a \(t\)-based interval with \(4\) degrees of freedom is \(0.134\pm2.776(0.001581)\), or approximately \([0.1296,0.1384]\). It describes uncertainty in the numerical integration estimate under the randomization procedure, not a confidence interval for an econometric parameter.

How QMC Compares With Pseudorandom Integration

With pseudorandom independent uniform draws \(U_j\), the usual estimate is also an average, but its standard error is estimated from the sample variation of \(h(U_j)\), divided by \(\sqrt{N}\). Under finite variance, its error typically decreases at rate \(N^{-1/2}\). QMC instead aims to improve coverage of the integration region; for sufficiently regular integrands and fixed dimension, its error can decrease faster as \(N\) grows. This does not make QMC universally more accurate at a fixed \(N\). A discontinuous or sharply concentrated integrand, an awkward transformation, or a high effective dimension can weaken its advantage.

When comparing methods, use the same integral, transformation, and computational budget where possible. Randomized QMC replicates allow a numerical variability estimate, while independent pseudorandom replications provide a comparable assessment for Monte Carlo. A single unusually favorable estimate is not enough to establish that one method is more accurate. It is also useful to inspect whether increasing \(N\) stabilizes the likelihood contribution and whether estimates from independent randomizations agree.

Common Pitfall and Practical Checks

Common pitfall: “The QMC points fill the cube evenly, so their estimate must be accurate, and the spread of the integrand values gives the standard error.” Even coverage alone does not control error for every integrand, and within-design point values are dependent. Check the integrand’s regularity and the transformation, and assess numerical variability using independent randomized designs rather than treating the points as independent draws.

Before relying on a QMC likelihood integral, verify that the transformation represents the intended latent distribution and that any required weights are present. Then compare estimates across independent randomizations and, when practical, across increasing point counts. If the estimates remain unstable, QMC has not yet demonstrated adequate numerical accuracy; more points, a better transformation, or a different integration strategy may be needed.

Check Your Understanding

Answer each question by referring to the integral and design involved.

  1. How does the probability integral transform convert a one-dimensional latent-variable expectation into an integral over the unit interval?
  2. What two properties appear in the Koksma–Hlawka error bound, and why does low discrepancy alone not guarantee a small error?
  3. Why should the spread across points in one QMC design not automatically be used as a standard error?
  4. In randomized QMC, what does the standard error across independent scrambles quantify, and what uncertainty does it not quantify?
  5. Name one condition under which QMC may have an advantage over pseudorandom integration and one feature that can weaken that advantage.
Clinical Biostats