chain_state {rmcmc}R Documentation

Construct a new chain state.

Description

The chain state object provides cached access to target distribution log density and its gradient.

Usage

chain_state(position, momentum = NULL)

Arguments

position

Position component of chain state.

momentum

Momentum component of chain state. Optional.

Value

New chain state object. A list with entries

Examples

state <- chain_state(c(0.1, -0.5))
target_distribution <- list(
  log_density = function(x) -sum(x^2) / 2,
  gradient_log_density = function(x) -x
)
state$gradient_log_density(target_distribution)

[Package rmcmc version 0.1.1 Index]