Construct target distribution from a BridgeStan StanModel
object.
Source: R/bridges.R
target_distribution_from_stan_model.Rd
Construct target distribution from a BridgeStan StanModel
object.
Value
A list with entries
log_density
: A function to evaluate log density function for target distribution given current position vector.value_and_gradient_log_density
: A function to evaluate value and gradient of log density function for target distribution given current position vector, returning as a list with entriesvalue
andgradient
.
Examples
model <- example_gaussian_stan_model()
target_distribution <- target_distribution_from_stan_model(model)
withr::with_seed(
876287L, state <- chain_state(stats::rnorm(model$param_unc_num()))
)
state$log_density(target_distribution)
#> [1] -37.48172