Skip to content

Sampling from an unnormalized pdf in Julia using Walker's MCMC algorithm

License

Notifications You must be signed in to change notification settings

igutierrezm/Walker2020Sampling.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Walker2020Sampling

Stable Dev Build Status codecov

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

Installation

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

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

or

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

Usage

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.

References

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

About

Sampling from an unnormalized pdf in Julia using Walker's MCMC algorithm

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages