Author igutierrezm
0 Stars
Updated Last
2 Years Ago
Started In
April 2021


Stable Dev Build Status codecov

Sampling from a univariate unnormalized pdf in Julia using Li & Walker's MCMC algorithm, see [1] for details.


Install with the Julia package manager Pkg, just like any other registered Julia package:

# Press ']' to enter the Pkg REPL mode.
pkg> add Walker2020Sampling


julia> using Pkg; 
julia> Pkg.add("Walker2020Sampling")


Suppose we want to draw the next state in a MCMC with target (unnormalized) log-pdf q() using Li & Walker's algorithm with parameter θ. Suppose further that the support of q() is [lb, ub], the current state of the main variable is y0, and the current state of the auxiliary variable is z0.

The first step is to set up the environment:

using Random, Walker2020Sampling
rng = MersenneTwister(1)

Then, we create a sampler s using Walker2020Sampler():

s = Walker2020Sampler(θ; lb, ub);

Finally, we draw the next state of the main and auxiliary variables using rand():

y1, z1 = rand(rng, s, q, y0, z0);

Be aware that both rng and s are modified in the process.


[1] Li, Y. and Walker, S. G. (2020). A latent slice sampling algorithm. arXiv e-prints, page arXiv:2010.08509.

Used By Packages

No packages found.