import MCMC from './_mcmc'; /** * Class implementing a component-wise (systematic-scan) [Gibbs sampler]{@link https://en.wikipedia.org/wiki/Gibbs_sampling}. * Cycles through the dimensions in a fixed order and replaces each in turn with a draw from its * full conditional distribution, given the current values of every other dimension. Because each * draw comes directly from the exact conditional, there is no accept/reject step: every iteration * is accepted and [ar]{@link ran.mc.MCMC#ar} is always 1. * * @class Gibbs * @memberof ran.mc * @param {Object} options Sampler options, as a single object. * @param {Function[]} options.conditionals Array of samplers, one per dimension. The d-th * conditional function is called as `conditionals[d](x, rng)` with the current full state (an * array where index d is about to be replaced) and the sampler's own PRNG (exposing * `rng.next(): number`, a uniform variate in [0, 1)), and must return a single draw from the full * conditional distribution of dimension d given the rest of the state. `seed()` only reproduces a * conditional's draws if the conditional actually consumes `rng` for its own randomness (e.g. * `rng.next()`); a conditional that ignores `rng` and constructs its own independent generator * remains non-reproducible regardless of `seed()` — see decisions/0026-gibbs-seed-rng-threading.md. * @param {Object=} options.config Sampler configuration (see MCMC base class for shared options). * `dim` defaults to `conditionals.length`; if provided explicitly it must match * `conditionals.length`. * @param {Object=} options.initialState Initial state of the sampler (see MCMC base class). * @constructor * @throws {Error} If options is not a plain object, or conditionals is not a non-empty array, or * config.dim is provided but does not match conditionals.length. */ export default class Gibbs extends MCMC { _conditionals: Function[]; /** * @param {Object} options Sampler options, as a single object. * @param {Function[]} options.conditionals Array of samplers, one per dimension. The d-th * function is called as `conditionals[d](x, rng)` with the current full state (an array where * index d is about to be replaced) and the sampler's own PRNG (exposing `rng.next(): number`, a * uniform variate in [0, 1)), and must return a single draw from the full conditional * distribution of dimension d given the rest of the state. `seed()` only reproduces a * conditional's draws if the conditional actually consumes `rng` for its own randomness (e.g. * `rng.next()`); a conditional that ignores `rng` and constructs its own independent generator * remains non-reproducible regardless of `seed()` — see decisions/0026-gibbs-seed-rng-threading.md. * @param {Object=} options.config Sampler configuration (see MCMC base class for shared * options). `dim` defaults to `conditionals.length`; if provided explicitly it must match * `conditionals.length`. * @param {Object=} options.initialState Initial state of the sampler (see MCMC base class). * @throws {Error} If options is not a plain object, or conditionals is not a non-empty array, or * config.dim is provided but does not match conditionals.length. */ constructor(options: { conditionals: Function[]; config?: any | undefined; initialState?: any | undefined; }); _iter(x: any): { x: any; accepted: boolean; }; _adjust(): void; _internal(): {}; static _validateOptions(options: any): void; static _isPlainObject(options: any): boolean; }