telescopic.examples

Targets with exact answers, for tests, tutorials and benchmarks.

Classes

Example

A target with exact answers.

telescopic.examples.banana()

The banana of Heng & Jacob (2019): \(\log\pi(x) = -(1 - x_0)^2 - 10(x_1 - x_0^2)^2\).

Exactly, \(x_0 \sim \mathcal N(1, 1/2)\) and \(x_1 \mid x_0 \sim \mathcal N(x_0^2, 1/20)\), so the mean is (1, 1.5) and the covariance [[0.5, 1], [1, 2.55]]. Its default initial distribution is \(U[-5, 5]^2\).

Returns:
Example
telescopic.examples.funnel(d=10)

Neal’s funnel: \(v \sim \mathcal N(0, 9)\) and \(x_i \mid v \sim \mathcal N(0, e^v)\).

The funnel of Neal (2003). The point is \((v, x_1, \dots, x_{d-1})\). The mean is 0, and the coordinates are uncorrelated with variances 9 and \(E[e^v] = e^{9/2}\). Its default initial distribution is \(\mathcal N(0, \Sigma)\), with that covariance.

Parameters:
dint

Dimension, at least 2.

Returns:
Example
telescopic.examples.gaussian(d=10, rho=0.9)

A correlated Gaussian \(\mathcal N(0, \Sigma)\) with \(\Sigma_{ij} = \rho^{|i-j|}\).

Its default initial distribution is \(\mathcal N(0, 4I)\).

Parameters:
dint

Dimension, at least 1.

rhofloat

Correlation of neighboring coordinates, in (-1, 1).

Returns:
Example
telescopic.examples.mixture()

The bimodal mixture \(\tfrac12\mathcal N(-4, 1) + \tfrac12\mathcal N(4, 1)\).

Jacob, O’Leary & Atchadé (2020), section 5.1. Its mean is 0 and its variance 17; its default initial distribution is \(\mathcal N(10, 10^2)\), theirs.

Returns:
Example
telescopic.examples.pumps()

The pump-failure model, as in Jacob, O’Leary & Atchadé (2020), section 5.2.

For 10 pumps, \(s_i \sim \mathrm{Poisson}(\lambda_i t_i)\), \(\lambda_i \sim \mathrm{Gamma}(1.802, \text{rate } \beta)\) and \(\beta \sim \mathrm{Gamma}(0.01, \text{rate } 1)\); the point is \((\lambda_1, \dots, \lambda_{10}, \beta)\). The Gibbs sampler draws each \(\lambda_i\) from \(\mathrm{Gamma}(1.802 + s_i, \text{rate } \beta + t_i)\) and \(\beta\) from \(\mathrm{Gamma}(0.01 + 18.02, \text{rate } 1 + \sum\lambda_i)\), one coordinate per block. The exact moments come from quadrature over \(\beta\), whose posterior is one-dimensional once the \(\lambda_i\) are integrated out. Its default initial distribution is \(U(0.001, 5)^{11}\).

Returns:
Example