sampler_nuts: No U-Turn Sampler.

Description Usage Arguments Value Examples

View source: R/samplers.R

Description

Adapted from Hoffman and Gelman (2014). The No U-Turn Sampler (NUTS) aims to eliminate the need to set a number of steps L that is present in Hamiltonian Monte Carlo, which may lead to undesirable behaviour in HMC if not set correctly.NUTS does so by recursively building a set of candidate points that span the target distribution, and stopping when it starts to double back (hence its name). More information can be found here

Usage

1
sampler_nuts(pdf, start, epsilon, iterations = 1024, delta_max = 1000)

Arguments

pdf

Probability Density Function of the target distribution.Takes 2 arguments: a vector with a position, and, optionally, a boolean determining whether to return the log density instead.

start

starting point

epsilon

step size. If left to the default value, a suitable step-size will be estimated

iterations

Times the sampler runs

delta_max

Measure of the required accuracy of the simulation. The authors recommend a large value (1000)

iterations_adapt

burn-in period

delta

desired acceptance rate (default at 0.6)

Value

matrix of size iterations x dimensions with the points visited by the sampler.

Examples

1
2
pd_func <- make_distr_pdf(distr::Norm())
nuts_results <- sampler_nuts(pd_func, start = 0, iterations = 20)

lucas-castillo/SampleR documentation built on Jan. 1, 2021, 8:25 a.m.