The $log_prob() method provides access to the Stan model's log_prob function

log_prob(unconstrained_variables, jacobian_adjustment = TRUE)

Arguments

unconstrained_variables

(numeric) A vector of unconstrained parameters to be passed to log_prob

jacobian_adjustment

(bool) Whether to include the log-density adjustments from un/constraining variables

Examples

# \dontrun{
fit_mcmc <- cmdstanr_example("logistic", method = "sample")
fit_mcmc$init_model_methods()
#> Error: Model methods cannot be used with a pre-compiled Stan executable, the model must be compiled again
fit_mcmc$log_prob(unconstrained_variables = c(0.5, 1.2, 1.1, 2.2))
#> Error: The method has not been compiled, please call `init_model_methods()` first
# }