Theory¶
This page derives the estimators that telescopic computes from pairs of coupled Markov chains, states what they guarantee, and gives the rules that choose their settings. The methods are those of Glynn & Rhee (2014) and Jacob, O’Leary & Atchadé (2020, JOA20), with the lag of Biswas, Jacob & Vanetti (2019, BJV19) and the tuning rules of Atchadé & Jacob (2024, AJ24). The code and its docstrings use the notation that the page defines.
Coupled chains¶
\(\pi\) is the target, \(P\) a Markov kernel that leaves \(\pi\) invariant, and \(\pi_0\) the initial distribution. \(\pi_t\) is the law of \(X_t\) when \(X_0 \sim \pi_0\) and each step follows \(P\).
A coupling \(\bar P\) of \(P\) with itself moves a pair of points so that each point, on its own, moves according to \(P\):
A coupling can make the two points equal with positive probability, which no pair of independent chains does on a continuous space.
With a lag \(L \ge 1\), a replicate runs one pair of chains:
Draw \(X_0\) and \(Y_0\) from \(\pi_0\) independently.
Draw \(X_t \sim P(X_{t-1}, \cdot)\) for \(t = 1, \dots, L\).
Until \(t\) reaches the run length \(m\) with the chains equal: while \(X_t \ne Y_{t-L}\), draw \((X_{t+1}, Y_{t+1-L}) \sim \bar P\big((X_t, Y_{t-L}), \cdot\big)\); once \(X_t = Y_{t-L}\), draw \(X_{t+1} \sim P(X_t, \cdot)\) and set \(Y_{t+1-L} = X_{t+1}\).
The meeting time is \(\tau = \inf\{t \ge L : X_t = Y_{t-L}\}\), so step 3 ends at
\(t = \max(\tau, m)\). Equality is exact: telescopic compares the coordinates with ==
and never uses a tolerance. After the meeting it simulates \(X\) alone, so
\(X_t = Y_{t-L}\) for every \(t \ge \tau\).
Each chain on its own is an ordinary Markov chain with kernel \(P\) started from \(\pi_0\), so \(X_t\) and \(Y_t\) both have the law \(\pi_t\).
The telescoping sum¶
For a test function \(h\), write \(\Delta_t = h(X_t) - h(Y_{t-L})\). If \(\mathbb E[h(X_t)] \to \pi(h)\), then for any \(k \ge 0\)
\(X_{k+(j-1)L}\) and \(Y_{k+(j-1)L}\) have the same law, so each difference is \(\mathbb E[\Delta_{k+jL}]\). Since \(\Delta_t = 0\) for \(t \ge \tau\), the sum inside the expectation has finitely many nonzero terms, and when \(\tau\) has enough moments the sum and the expectation can be exchanged:
\(H_k\) is an unbiased estimator of \(\pi(h)\) that each replicate computes in finite time. Its first term is an ordinary MCMC draw after \(k\) steps. The rest corrects its bias.
The time-averaged estimator¶
Averaging \(H_l\) over \(l = k, \dots, m\) keeps the unbiasedness and usually lowers the variance:
The difference \(\Delta_t\) enters \(H_l\) when \(t - l\) is a positive multiple of \(L\), so its weight \(v_t\) counts the \(l \in [k, m]\) with \(l = t - jL\) for some \(j \ge 1\). The conditions \(j \ge 1\), \(j \le (t-k)/L\) and \(j \ge (t-m)/L\) give
With \(L = 1\), \(v_t/(m-k+1) = \min\big(1, (t-k)/(m-k+1)\big)\) (JOA20, eq. 2.1). \(\mathrm{MCMC}_{k:m}\) is the usual average after a burn-in of \(k\) steps, and \(\mathrm{BC}_{k:m}\) is zero when the chains meet within \(k + L\) steps.
Thinning. Averaging over any set \(S \subseteq \{k, \dots, m\}\) also gives an unbiased
estimator, \(H_S = |S|^{-1}\sum_{l \in S} H_l\). The argument thin \(= s\) uses
\(S = \{k, k+s, k+2s, \dots\} \cap [k, m]\), and \(\Delta_t\) then has the coefficient
which is \(v_t/(m-k+1)\) when \(s = 1\). Thinning stores fewer points. It does not shorten the run, which still ends at \(\max(\tau, m)\).
Signed measures¶
Each replicate’s estimator is the integral of \(h\) against a signed measure,
so that \(\hat\pi(h) = H_S\) for every \(h\). telescopic stores these atoms and weights, so any test function can be applied after the run. The weights sum to 1, and some are negative, so an estimate can fall outside the range of \(h\). A replicate stores at most \(|S| + 2\max(0, \tau - \min S - L)\) atoms, since atoms with \(c_t = 0\) are dropped.
Cost¶
A replicate uses \(C = L + 2(\tau - L) + \max(0, m - \tau)\) applications of the kernel, counting a coupled step before the meeting as two. Its relative cost is the mean cost divided by \(m - k + 1\), the number of averaged states: the cost per averaged state, against about 1 for an MCMC average without burn-in. The inefficiency of the estimator is \(\mathbb E[C]\,\mathbb V[H_{k:m}]\) (Glynn & Whitt 1992; JOA20 §3.1): at a fixed budget of kernel applications, the variance of the average over replicates is the inefficiency divided by the budget, so it is the figure to minimize when comparing kernels or settings. Kernels differ in the log-density and gradient evaluations per application, so telescopic also counts those, and the wall time.
Guarantees and their limits¶
Guaranteed:
Unbiasedness: \(\mathbb E[H^{(L)}_{k:m}] = \pi(h)\) for every \(0 \le k \le m\), \(L \ge 1\) and every \(\pi_0\) from which the chain converges, provided that the coupling preserves both marginals, the pair stays together after meeting, and one of three published sets of conditions holds. In practice they ask for meeting times with light tails and for an \(h\) with enough moments under the chain. A run checks the first from 500 replicates, for a tail that shows up in it:
result.diagnostics()["tail_index"]estimates the tail index and thetailwarning fires below 2 (Heavy-tailed meeting times). The precise conditions are:JOA20, Prop. 3.1: the chain started from \(\pi_0\) converges in the sense of their Assumption 2.1, \(\mathbb E[h(X_t)] \to \pi(h)\) as \(t \to \infty\) with \(\sup_t \mathbb E|h(X_t)|^{2+\eta} < \infty\) for some \(\eta > 0\), and \(\tau\) has geometric tails;
Middleton et al. (2020, Thm. 1): the same convergence assumption, and polynomial tails, \(P(\tau > t) \le K t^{-\kappa}\) with \(\kappa > 2(2/\eta + 1)\);
Douc et al. (2022, Thm. 17): \(P\) is \(\pi\)-irreducible, \(\mathbb E_{\pi\otimes\pi}[\tau^\kappa] < \infty\) with \(\kappa > 1\), \(h \in L^p(\pi)\) with \(p > \kappa/(\kappa-1)\), and \(d\pi_0/d\pi \le M\), which replace the convergence assumption. Under these, the variance is finite if \(\kappa > 2\) and \(p > 2\kappa/(\kappa - 2)\).
A fast meeting does not show convergence. A kernel that cannot leave the region where it starts, such as a Gibbs sampler on two squares that share no coordinate value, meets there and estimates the expectation over that region alone, and the guarantee does not hold. A kernel that can leave only by a rare move, such as a random walk whose steps are much shorter than a gap in the support, can meet the conditions and be unbiased, but the replicates that carry the correction are too rare to occur in a run, so the estimate is confidently wrong at any practical number of replicates (When unbiased is not enough). An independence proposal tuned to one of two well-separated modes, mixed with such a random walk, is another such kernel, whose pairs meet within a few tens of steps (A tuned proposal that covers one mode).
Error bars: with \(R \ge 2\) independent replicates and finite variance, \(\bar H \pm t_{R-1,\,1-\alpha/2}\,\hat\sigma/\sqrt R\), with \(t_{R-1,\,1-\alpha/2}\) the \(1 - \alpha/2\) quantile of Student’s t with \(R - 1\) degrees of freedom, is an asymptotically valid interval as \(R \to \infty\), and an exact one at every \(R\) when the replicates are normal. At small \(R\) it is wider than the interval with the normal quantile, which covers less than its level. That the cost of each replicate is random does not change this.
Fixed \(R\): unbiasedness holds for a number of replicates fixed before any result is seen. Choosing \(R\) after looking at results, for example extending a run until the error bar is small, is optional stopping: the mean stays consistent and the large-\(R\) intervals stay valid, but exact unbiasedness is lost.
Total-variation bounds: meeting times give upper bounds on \(d_{TV}(\pi_t, \pi)\) (see below).
Not guaranteed:
a small error at finite \(R\);
valid intervals when the variance is infinite;
better mixing than the underlying kernel: “coupling pairs of Markov chains does not improve their marginal mixing properties” (JOA20, §6);
estimates inside the range of \(h\);
exact draws from \(\pi\);
robustness to a poor \(\pi_0\). On a bimodal target with \(\pi_0\) concentrated in one mode, JOA20 (§5.1) report a 95% interval of [0.799, 0.816] for a true value of 0.421 at \(R = 1000\).
Estimates from many replicates¶
Let \(a_r = \hat\pi_r(h) \in \mathbb R^p\) for replicates \(r = 1, \dots, R\), with mean \(\bar a\) and sample covariance \(S_a\) (divisor \(R - 1\)).
Expectations: \(\bar a\), with standard errors \(\sqrt{\mathrm{diag}(S_a)/R}\) and Monte Carlo covariance \(S_a/R\).
Products of expectations: \(\bar a\bar a^\top - S_a/R\) is unbiased for \(\pi(h)\pi(h)^\top\) when \(R \ge 2\).
Covariance: \(\widehat{\mathrm{Cov}}_\pi(h) = R^{-1}\sum_r \hat\pi_r(hh^\top) - \bar a\bar a^\top + S_a/R\) is unbiased. Standard deviations are \(\sqrt{\max(0, \widehat{\mathrm{Var}})}\), which is consistent but not unbiased.
Histograms: each replicate’s signed mass in each bin, averaged over replicates, is unbiased for bins fixed before the run, with standard errors from the replicates. Bins are half-open, \([a, b)\), except the last, which is closed, as in
numpy.histogram. A bin can be negative.Quantiles: pool the atoms of all replicates with weights \(\omega/R\), merging atoms with equal coordinates; sort them along the coordinate; project the cumulative weights onto non-decreasing sequences by isotonic regression and clip them to \([0, 1]\); the \(\beta\)-quantile is the smallest atom whose projected cumulative weight is at least \(\beta\). This is consistent as \(R \to \infty\) but not unbiased (JOA20, Prop. 3.2).
Keeping a subset¶
With keep \(= K\), the replicates of index below \(K\) store their signed measures and every
replicate stores its moments. The kept set is fixed before any replicate runs, so the
estimates of the kept replicates are unbiased, or consistent for quantiles, as those of a
run of them alone. Each replicate stores its center \(c_r = X_k\), \(f_r = \hat\pi_r(x -
c_r)\) and the entries of \(S_r = \hat\pi_r((x - c_r)(x - c_r)^\top)\) on and above the
diagonal, or only the diagonal above \(d = 100\). Since each replicate’s weights sum to 1,
so the mean and the covariance estimator above, with \(b = \bar a\), are exactly those of the atoms, for any centers, and are unbiased over all \(R\) replicates; the centers affect only rounding. The two sets of replicates are not independent, so no error statement covers an estimate from one combined with one from the other.
Choosing k, m and L¶
The settings change the cost and the variance, never the bias. telescopic follows AJ24: from the meeting times of \(R_0 = 100\) pilot pairs with \(L = 1\),
\(k = \max(1, \hat q_\beta(\tau - 1))\), with \(\hat q_\beta\) the inverted-CDF sample quantile and \(\beta = 0.99\);
\(L = k\);
\(m = 10k\).
With \(L = k\) most pairs meet within \(k + L\) steps, so \(\mathrm{BC}_{k:m}\) is usually zero and the estimator is an ordinary MCMC average after a burn-in of \(k\). A pair that meets before \(m\) costs \(m + \tau - L\), so with \(m = 10k\) and \(\tau - L \le k\) the relative cost is about \(10/9\) to \(11/9\). \(\beta \le 1 - 1/R_0\) is required, so that \(\hat q_\beta\) is not the sample maximum.
Distance to stationarity¶
For any \(L\) and \(t \ge 0\) (BJV19, Thm. 2.5),
The argument telescopes the laws: when \(\pi_s \to \pi\), \(\pi_t - \pi = \sum_{j \ge 1} (\pi_{t+(j-1)L} - \pi_{t+jL})\). \(Y_{t+(j-1)L}\) has law \(\pi_{t+(j-1)L}\) and \(X_{t+jL}\) has law \(\pi_{t+jL}\), so for any set \(A\) the \(j\)-th term is at most \(\mathbb P(X_{t+jL} \ne Y_{t+(j-1)L}) = \mathbb P(\tau > t + jL)\) in absolute value, by the coupling inequality.
telescopic estimates the bound by the average over replicates and reports \(\min(1, \cdot)\), with the standard error of the average, the sample standard deviation of the replicates’ terms over \(\sqrt R\); it estimates the 1-Wasserstein bound below in the same way. With \(L = k\), its value at \(t = k\) is close to \(\mathbb P(\tau - L > k)\), the fraction of pairs that meet late. A pair still unmet at its cap is known to meet after it, since its chains were compared at the cap, and counts as meeting at the cap plus 1, so with censored pairs the estimate is a lower bound; so is that of the 1-Wasserstein bound below, whose distances stop at the cap.
The same argument bounds the 1-Wasserstein distance:
It depends on the parameterization of the target, through the Euclidean norm.
References¶
The works cited here are listed on Citing.