Description Usage Arguments Value Examples
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
1 | sampler_nuts(pdf, start, epsilon, iterations = 1024, delta_max = 1000)
|
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) |
matrix of size iterations x dimensions with the points visited by the sampler.
1 2 | pd_func <- make_distr_pdf(distr::Norm())
nuts_results <- sampler_nuts(pd_func, start = 0, iterations = 20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.