Calculate the log-probability , the gradient w.r.t. each input, and the hessian for a given vector of unconstrained parameters — fit-method-hessian • cmdstanr
Description: The $hessian() method provides access to the Stan model's log_prob, its derivative, and its hessian.

# Calculate the log-probability , the gradient w.r.t. each input, and the hessian for a given vector of unconstrained parameters

Source: `R/fit.R`
`fit-method-hessian.Rd`

The `$hessian()` method provides access to the Stan model's `log_prob`, its derivative, and its hessian.

    hessian(unconstrained_variables, jacobian_adjustment = TRUE)

## Arguments

unconstrained_variables

  (numeric) A vector of unconstrained parameters to be passed to `hessian`.

jacobian_adjustment

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

## See also

`log_prob()`, `grad_log_prob()`, `constrain_variables()`, `unconstrain_variables()`, `unconstrain_draws()`, `variable_skeleton()`, `hessian()`

## Examples

    # \dontrun{
    fit_mcmc <- cmdstanr_example("logistic", method = "sample", force_recompile = TRUE)
    #> Compiling Stan program...
    # fit_mcmc$init_model_methods(hessian = TRUE)
    # fit_mcmc$hessian(unconstrained_variables = c(0.5, 1.2, 1.1, 2.2))
    # }