XDNUTS-package {XDNUTS} | R Documentation |
Discontinuous Hamiltonian Monte Carlo with Varying Trajectory Length
Description
Hamiltonian Monte Carlo for both continuous and discontinuous posterior distributions with customisable trajectory length termination criterion. See Nishimura et al. (2020) <doi:10.1093/biomet/asz083> for the original Discontinuous Hamiltonian Monte Carlo, Hoffman et al. (2014) <doi:10.48550/arXiv.1111.4246> and Betancourt (2016) <doi:10.48550/arXiv.1601.00225> for the definition of possible Hamiltonian Monte Carlo termination criteria.
Details
The DESCRIPTION file:
Package: | XDNUTS |
Type: | Package |
Title: | Discontinuous Hamiltonian Monte Carlo with Varying Trajectory Length |
Version: | 1.5.5 |
Date: | 2024-12-22 |
Authors@R: | person("Paolo", "Manildo", email = "paolo.manildo@studenti.unipd.it", role = c("aut", "cre"), comment = c(ORCID = "0009-0006-7056-7012")) |
Description: | Hamiltonian Monte Carlo for both continuous and discontinuous posterior distributions with customisable trajectory length termination criterion. See Nishimura et al. (2020) <doi:10.1093/biomet/asz083> for the original Discontinuous Hamiltonian Monte Carlo, Hoffman et al. (2014) <doi:10.48550/arXiv.1111.4246> and Betancourt (2016) <doi:10.48550/arXiv.1601.00225> for the definition of possible Hamiltonian Monte Carlo termination criteria. |
License: | MIT + file LICENSE |
Imports: | base, coda, ggplot2, graphics, grDevices, gridExtra, parallel, purrr, Rcpp (>= 1.0.12), Rdpack, stats |
RdMacros: | Rdpack |
LinkingTo: | Rcpp, RcppArmadillo |
RoxygenNote: | 7.3.1 |
Suggests: | knitr, rmarkdown, KernSmooth |
VignetteBuilder: | knitr |
Depends: | R (>= 2.10) |
LazyData: | true |
Author: | Paolo Manildo [aut, cre] (<https://orcid.org/0009-0006-7056-7012>) |
Maintainer: | Paolo Manildo <paolo.manildo@studenti.unipd.it> |
Index of help topics:
XDNUTS-package Discontinuous Hamiltonian Monte Carlo with Varying Trajectory Length main_function Function to generate a Markov chain for both continuous and discontinuous posterior distributions. plot.XDNUTS Function to view the draws from the posterior distribution. print.XDNUTS Function for printing an object of class XDNUTS print.summary.XDNUTS Function for printing an object of class summary.XDNUTS set_parameters Function that regulates the specifications of the xdnuts function. summary.XDNUTS Function to print the summary of an XDNUTS model. viscosity Blood viscosity data xdextract Function to extract samples from the output of an XDNUTS model. xdnuts Discontinuous Hamiltonian Monte Carlo using both manual and automatic termination criteria. xdtransform Function to apply a transformation to the samples from the output of an XDNUTS model.
The package allows to use a more efficient version of the Discontinuous Hamiltonian Monte Carlo proposed in (Nishimura et al. 2020), thanks to the use of recycled samples from each trajectory (Nishimura and Dunson 2020) and a termination criterion for identyfing the optimal discrete integration time of each trajectory (Betancourt 2016). No models are at disposal, so the user must specify one through the definition of the function nlp
. This function must evaluate the negative log posterior of the model and its gradient with respect to the first d-k
parameters. d
is the model dimension, while k
is the number of parameters for which the sampling scheme will be based on the method described in (Nishimura et al. 2020). This method was born for treating discontinuous components but it is applicable to continuous one too. nlp
must be a function with 3 arguments:
the vector of parameters, current state of the chain/trajectory, for which the negative log posterior or its gradient must be evaluated.
a list object that contains the necessary argouments, namely data and hyperparameters.
a boolean value,
TRUE
to evaluate only the negative log posterior of the models,FALSE
to evaluate its gradient with respect to the continuous components of the posterior.
The available algorithms are the following
- NUTS
No U-Turn Sampler of (Hoffman et al. 2014).
- XHMC
Hamiltonian Monte Carlo with a termination criterion based on the exhustion of the virial (Betancourt 2016) which require the specification of a threshold.
- HMC
Hamiltonian Monte Carlo with trajectory length varying uniformly inside a user specified interval. Instead of proposing the last value of each trajectories a sample is drawn uniformly from them. Reference can be found in (Betancourt 2017).
All of them are embedded into the framework described in (Nishimura et al. 2020) which allows the use of Hamiltonian Monte Carlo with discontinuous posterior and hence to discrete parameter space by the definition of a step function shape density.
Author(s)
Paolo Manildo [aut, cre] (<https://orcid.org/0009-0006-7056-7012>)
Maintainer: Paolo Manildo <paolo.manildo@studenti.unipd.it>
References
Hoffman MD, Gelman A, others (2014).
“The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo.”
J. Mach. Learn. Res., 15(1), 1593–1623.
Betancourt M (2016).
“Identifying the optimal integration time in Hamiltonian Monte Carlo.”
arXiv preprint arXiv:1601.00225.
Betancourt M (2017).
“A conceptual introduction to Hamiltonian Monte Carlo.”
arXiv preprint arXiv:1701.02434.
Nishimura A, Dunson DB, Lu J (2020).
“Discontinuous Hamiltonian Monte Carlo for discrete parameters and discontinuous likelihoods.”
Biometrika, 107(2), 365–380.
Nishimura A, Dunson D (2020).
“Recycling Intermediate Steps to Improve Hamiltonian Monte Carlo.”
Bayesian Analysis, 15(4).
ISSN 1936-0975, doi:10.1214/19-ba1171, http://dx.doi.org/10.1214/19-BA1171.