Skip to content

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

License

Notifications You must be signed in to change notification settings

igutierrezm/Walker2014Sampling.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Walker2014Sampling

Stable Dev Build Status codecov

Sampling from an unnormalized pmf in Julia using Walker's MCMC algorithm, see Walker (2014) 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 Walker2014Sampling

or

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

Usage

Suppose we want to draw the next state in a MCMC with target (unnormalized) pmf p() using Walker's algorithm with parameter k. Suppose further that the support of p() is ℕ and the current state is x0.

The first step is to set up the environment:

using Random, Walker2014Sampling
rng = MersenneTwister(1)

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

s = Walker2014Sampler(k);

Finally, we draw the next state using rand():

x1 = rand(rng, p, s, x0);

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

References

Walker, S. G. (2014). Sampling unnormalized probabilities: An alternative to the Metropolis--Hastings algorithm. SIAM Journal on Scientific Computing, 36(2), A482–A494. https://doi.org/10.1137/130922549#

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages