Skip to content
Senghak Rou
All projects

Statistics & Econometrics · Apr – May 2026

Likelihood-free inference for log-normal sums

Bayesian inference for a model whose likelihood has no closed form, by simulation: rejection and MCMC versions of approximate Bayesian computation, compared on accuracy and cost.

Status
Completed
Setting
Team project (3)ENSAE course project — Simulation and Monte Carlo (Nicolas Chopin), 2025–2026
My role
Rejection ABC and its analysis, the shared JAX implementations, and the benchmark of the two samplers.
Methods and tools
Python · JAX · NumPy · SciPy · Matplotlib · Jupyter

5.1×

Speed-up of MCMC-ABC over rejection ABC at the strictest tolerance tested (ε = 0.5)

35.8 s vs 7.0 s (mean of 3 runs), for the run lengths used

0.14 vs 0.09

Posterior mean of σ² at ε = 0.5 (both samplers) against the true value

Both samplers used the same simulated data and tolerance

Overview

Some models are easy to simulate but have a likelihood that cannot be written down, so standard Bayesian inference fails at the first step. Approximate Bayesian computation (ABC) replaces the likelihood by simulation. For the Simulation and Monte Carlo course, our team of three applied it to sums of log-normal variables. The main lesson is quantitative: the error comes mostly from the tolerance and the prior, while the choice of sampler mainly changes the cost.

Setup

Each observation is a sum of L=10L = 10 log-normal variables, whose density has no closed form:

Yi=∑ℓ=1LeXiℓ,Xiℓ∼iidN(μ,σ2).Y_i = \sum_{\ell=1}^{L} e^{X_{i\ell}}, \qquad X_{i\ell} \overset{\text{iid}}{\sim} \mathcal{N}(\mu, \sigma^2).

Data are simulated with μ0=0\mu_0 = 0 and σ02=0.09\sigma_0^2 = 0.09, so the truth is known. The prior is μ∼N(0,s2)\mu \sim \mathcal{N}(0, s^2) and log⁡σ2∼N(0,t2)\log\sigma^2 \sim \mathcal{N}(0, t^2). ABC replaces the posterior by

πε(θ∣y⋆)  ∝  π(θ)  P(W1(Y(θ),y⋆)≤ε),\pi_\varepsilon(\theta \mid y^\star) \;\propto\; \pi(\theta)\; \mathbb{P}\bigl( W_1(Y(\theta), y^\star) \le \varepsilon \bigr),

For a fixed sample and this full-distribution distance, reducing the tolerance forces accepted simulations closer to the observations. The 1-Wasserstein distance compares whole sorted samples rather than a few hand-picked statistics:

W1(Y,y⋆)=1n∑i=1n∣Y(i)−y(i)⋆∣.W_1(Y, y^\star) = \frac{1}{n} \sum_{i=1}^{n} \bigl| Y_{(i)} - y^\star_{(i)} \bigr|.
Approximate Bayesian computation: simulate, compare, accept A parameter θ′ = (μ, σ²) is proposed, from the prior in rejection ABC or by a random walk from the current value in MCMC-ABC. A sample of sums of ten log-normal variables is simulated under θ′ and compared with the observed sample using the 1-Wasserstein distance between sorted values. θ′ is kept if the distance is at most ε; kept draws approximate the posterior. prior π(θ) widths s, t draw θ' simulate n sums of 10 log-normals simulated observed y⋆ W1 sorted-sample distance ≤ ε ε keep approximate posterior MCMC-ABC instead proposes θ' = θ + δ ξ from the current draw step δ
Figure 1 · SchematicOne ABC step. Rejection ABC draws θ′ from the prior; MCMC-ABC proposes a random-walk move on (μ, log σ²) and also applies the Metropolis–Hastings prior ratio. Orange: tuning quantities.

Rejection ABC (my part)

The tolerance was calibrated on prior-predictive distances: the 1 % quantile (ε≈0.98\varepsilon \approx 0.98) accepts about one proposal in 100.

Two panels: ABC posterior densities of mu (left) and sigma squared (right) for tolerances at the 20, 10, 1 and 0.5 percent quantiles of prior-predictive distances, with the prior and the true values marked.
Figure 2 · Experimental resultAs ε shrinks, the posterior concentrates. For σ² it concentrates above the truth (dashed red line): a smaller tolerance reduces, but does not remove, the bias.Source: Generated by Reject_ABC.ipynb (my notebook) in the project repository.
  • μ is recovered; σ² is overestimated. Both parameters raise the scale of YiY_i, since E[Yi]=L eμ+σ2/2\mathbb{E}[Y_i] = L\,e^{\mu + \sigma^2/2}, so they partly compensate.
  • The prior on σ² matters most. Widening the prior on μ only lowers the acceptance rate. A narrow prior on log⁡σ2\log\sigma^2 (t=0.3t = 0.3) puts almost no mass near the truth and accepted only 11 draws.
  • The error is approximation, not Monte Carlo noise. Over 20 seeds, the spread of estimates was small compared with their distance from the truth.

Rejection against MCMC-ABC

I implemented both samplers in one JAX module and ran them on the same simulated data for six tolerances, three times each.

Reject-ABC and MCMC-ABC on the same data, across tolerances ε

Mean over 3 repetitions (bands: ± 1 s.d.). n = 1,000 observations, L = 10, one simulated dataset per proposal.

  • Reject-ABC
  • MCMC-ABC

(a) Runtime, log scale

1310300.511.522.53Tolerance εSecondsReject-ABC, ε = 0.5: 35.8 sReject-ABC, ε = 0.7: 16.4 sReject-ABC, ε = 1: 8 sReject-ABC, ε = 1.5: 3.4 sReject-ABC, ε = 2: 2.2 sReject-ABC, ε = 3: 1.2 sMCMC-ABC, ε = 0.5: 7 sMCMC-ABC, ε = 0.7: 7.2 sMCMC-ABC, ε = 1: 7.5 sMCMC-ABC, ε = 1.5: 6.9 sMCMC-ABC, ε = 2: 6.9 sMCMC-ABC, ε = 3: 7.2 s

(b) Posterior mean of σ²

00.20.40.60.511.522.53Tolerance εE[σ² | y]true σ² = 0.09Reject-ABC, ε = 0.5: E[σ² | y] = 0.148Reject-ABC, ε = 0.7: E[σ² | y] = 0.18Reject-ABC, ε = 1: E[σ² | y] = 0.232Reject-ABC, ε = 1.5: E[σ² | y] = 0.319Reject-ABC, ε = 2: E[σ² | y] = 0.409Reject-ABC, ε = 3: E[σ² | y] = 0.551MCMC-ABC, ε = 0.5: E[σ² | y] = 0.142MCMC-ABC, ε = 0.7: E[σ² | y] = 0.174MCMC-ABC, ε = 1: E[σ² | y] = 0.227MCMC-ABC, ε = 1.5: E[σ² | y] = 0.317MCMC-ABC, ε = 2: E[σ² | y] = 0.42MCMC-ABC, ε = 3: E[σ² | y] = 0.569

(c) Acceptance rate

02040600.511.522.53Tolerance εAccepted (%)Reject-ABC, ε = 0.5: 0.2% acceptedReject-ABC, ε = 0.7: 0.5% acceptedReject-ABC, ε = 1: 1.1% acceptedReject-ABC, ε = 1.5: 2.9% acceptedReject-ABC, ε = 2: 5.6% acceptedReject-ABC, ε = 3: 11.7% acceptedMCMC-ABC, ε = 0.5: 13.1% acceptedMCMC-ABC, ε = 0.7: 18.4% acceptedMCMC-ABC, ε = 1: 26.4% acceptedMCMC-ABC, ε = 1.5: 38.1% acceptedMCMC-ABC, ε = 2: 48.4% acceptedMCMC-ABC, ε = 3: 62.3% accepted
Data table
MethodεRuntime (s)E[μ | y]E[σ² | y]AcceptanceESS / s
MCMC-ABC0.57-0.0290.14213.1%33.1
MCMC-ABC0.77.2-0.0450.17418.4%31.4
MCMC-ABC17.5-0.0750.22726.4%40.9
MCMC-ABC1.56.9-0.1250.31738.1%46.8
MCMC-ABC26.9-0.1850.4248.4%62.2
MCMC-ABC37.2-0.2780.56962.3%55.1
Reject-ABC0.535.8-0.0310.1480.2%8.4
Reject-ABC0.716.4-0.050.180.5%18.4
Reject-ABC18-0.0770.2321.1%37.6
Reject-ABC1.53.4-0.1210.3192.9%89.5
Reject-ABC22.2-0.1760.4095.6%136.1
Reject-ABC31.2-0.2620.55111.7%259.8
Figure 3 · Experimental resultLeft: rejection ABC grows expensive as ε shrinks, while MCMC-ABC runs a fixed number of iterations. Centre: both target the same ABC posterior, whose mean of σ² drifts away from the true 0.09 as ε grows. Right: MCMC-ABC accepts far more proposals. Laptop wall-clock times, comparable only within this benchmark.Source: benchmark_results.csv produced by benchmark2.py (repository commit a2dee41).

Both samplers give nearly the same posterior means at each ε\varepsilon, as expected since they target the same πε\pi_\varepsilon. Rejection ABC becomes expensive as ε\varepsilon shrinks; per effective sample per second, MCMC-ABC wins at small tolerances (33 against 8 at ε=0.5\varepsilon = 0.5) and rejection wins at large ones (260 against 55 at ε=3\varepsilon = 3).

Limitations

  • One synthetic configuration, with a prior on log⁡σ2\log\sigma^2 centred far from the truth; the bias depends on this choice.
  • Laptop runtimes with three repetitions: valid for relative comparisons within this benchmark only.

Individual contribution

References

  1. Marjoram, P., Molitor, J., Plagnol, V. and Tavaré, S. (2003). Markov chain Monte Carlo without likelihoods. PNAS 100(26), 15324–15328.
  2. Bernton, E., Jacob, P. E., Gerber, M. and Robert, C. P. (2019). Approximate Bayesian computation with the Wasserstein distance. JRSS B 81(2), 235–269.
Nov 2026 – presentIn development

Data Science Lab

Follow a model from its equations to a working implementation. Four interactive labs connect mathematical lessons, browser experiments and real Python runs that expose intermediate values.

Scientific Computing & Software · Individual · TypeScript, Next.js, Three.js