Learn R Programming

XDNUTS (version 1.6)

trajectories: Function that approximate the Hamiltonian Flow for given starting values of the position and momentum of a particle in the phase space defined by the kinetic and potential energy provided in input.

Description

Function that approximate the Hamiltonian Flow for given starting values of the position and momentum of a particle in the phase space defined by the kinetic and potential energy provided in input.

Usage

trajectories(theta0, m0, nlp, args, eps, k, M_cont, M_disc, max_it)

Value

a data frame that summarizes the approximated Hamiltonian flow.

  • The first \(d\) columns contain the particle position evolution.

  • The second \(d\) columns contain the particle momenta evolution.

  • The \(2d + 1\) column contains the Hamiltonian evolution.

  • The \(2d + 2\) column contains the evolution of the No U-Turn Sampler termination criterion.

  • The \(2d + 3\) column contains the evolution of the virial exhaustion termination criterion.

  • Acceptance and or refraction probabilities. This depends on the value of k.

  • Reflession dummy indicators.

  • Divergent transition dummy indicators.

Arguments

theta0

a numeric vector of length \(d\) representing the starting position vector for the particle.

m0

a numeric vector of length \(d\) representing the starting momenta vector for the particle.

nlp

a function object that evaluate the negative of the logarithm of a probability density function, and its gradient, i.e. the potential energy function of the system.

args

a list object containing the arguments to be passed to the function nlp.

eps

a numeric scalar indicating the step size for the leapfrog integrator.

k

an integer scalar indicating the number of discontinuous components of theta0.

M_cont

either a vector or a squared matrix, of the same length/dimension of the position/momenta vector, representing the continuous components mass matrix.

M_disc

a vector of the same length of the position/momenta vector, representing the discontinuous components mass matrix.

max_it

an integer value indicating the length of the trajectory. This quantity times eps is equal to the approximated integration time of the Hamiltonian flow.