Description Usage Arguments Value
The function is modified version of Hamiltonian Monte Carlo with Dual Averaging. Based on the post by Radford Neal, Hamiltonian dynamics can be periodic for variables. It is possible for the period for a variabl to match its trajectory length, resulting the ending point close to the starting point. To address this issue, Neal proposes to randomly vary the trajectory length over some moderate range. Therefore, one modification is made: the previous code: Lm<-max(1,round(lambda/epsilon)) is changed to the new code: Lm<-max(1,round((0.9 + runif(1)/5)*lambda/epsilon))
1 | HmcDualMod(theta0, delta, lambda, L, M, Madapt)
|
theta0 |
a p-dimensional vector with the initial value for each parameter. |
delta |
the desired average acceptance probability |
lambda |
trajectory length for leapfrog |
L |
a callable function that returns a 2-dimensional vector whose first element is the logarithm of the density of the input and the second is the gradient of the logarithm of the density evaluated at the input. |
M |
an integer specifying the number of iterations. |
Madapt |
an integer specifying the number of iterations of the warmup phase. |
This function returns a matrix which m-th row is a sample from the joint density.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.