Description Usage Arguments Details Value Author(s) References See Also
This function performs Hamiltonian MCMC for continuous distributions.
1 2 3 4 |
lpgrf |
This |
initial |
Starting values as a list. Again each element of the starting value must be a matrix on the CPU or GPU. The number columns of each matrix is the number of parrallel runs. |
nsims |
Total number of simulations includeing burnin. |
nsteps |
Tuning parameter for HMC representing the number of leepfrog steps for each iteration. |
step |
Tuning parameter for HMC controls the length of each leepfrog steps for each iteration. |
nstepsburnin |
Tuning parameter for HMC representing the number of leepfrog steps for each iteration. This parameter is used only during burnin. |
stepburnin |
Tuning parameter for HMC controls the length of each leepfrog steps for each iteration. This parameter is used only during burnin. |
Tstart |
During the burnin phase only tempering is used to get the simulation moving. Tstart is the starting temperature. |
r |
The temperature during the burning phase is exponentially decreased at a rate |
burnin |
The number of iterations used for burnin. All burnin samples are discarded. |
keep |
Function to extract samples to keep. If defualt keep function is defined as |
thin |
Selects the number of samples to keep. |
report |
Controls how often an update of the progress is printed out. |
The most important input of gBasicHMC()
is the lpgrf
parameter. This lpgrf
input must be a function which takes as its input a list of parameters and gives as its output the log probability (lp
) excluding the normalization constant and a first derivative of the log probability (gr
). Both the lp
and gr
information must be returned as slots in an object of class lpgrf
. The lp
slot must be a numberic CPU vector while gr
slot must be a list with elements either on the CPU or GPU.The function gBasicHMC()
is designed to run multiple chains simultaneously. Thus each element in the input is expected to be a matrix where the number of columns is the number of parallel chains and the number of rows is the dimension of the random variable being simulated. The input is assumed to be a list of parameters because in many cases there are different types of parameters such as hyper-parameters. Tracking the current stated of the chain using a list is therefore often quite natural. As a result of this convention, the gr
slot for lpgr
object returned by the lpgrf
function must also be a list.
Output is a list:
sims |
A list with the simulation results from each iteration as elements. |
lp |
A matrix with the simulation log probabilities for all simulations. |
AcceptanceRate |
Acceptence rate for each parallel chain. |
BurninAcceptanceRate |
Acceptence rate during the burnin phase for each parallel chain. |
Nathan Morris (this is actually a significantly modified version of an HMC implementation created by Radford Neal: http://www.cs.utoronto.ca/~radford/GRIMS.html)
Neal, Radford M. "MCMC using Hamiltonian dynamics." Handbook of Markov Chain Monte Carlo 2 (2011).
Beam, Andrew L., Sujit K. Ghosh, and Jon Doyle. "Fast hamiltonian monte carlo using gpu computing." Journal of Computational and Graphical Statistics just-accepted (2015): 00-00.
lpgr-class
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.