Compile additional methods for accessing the model log-probability function and parameter constraining and unconstraining. — fit-method-init_model_methods • cmdstanr
Description: The $init_model_methods() method compiles and initializes the log_prob, grad_log_prob, constrain_variables, unconstrain_variables and unconstrain_draws functions. These are then available as methods of the fitted model object. This requires the additional Rcpp and RcppEigen packages, which are not required for fitting models using CmdStanR. Note: there may be many compiler warnings emitted during compilation but these can be ignored so long as they are warnings and not errors.

# Compile additional methods for accessing the model log-probability function and parameter constraining and unconstraining.

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

The `$init_model_methods()` method compiles and initializes the `log_prob`, `grad_log_prob`, `constrain_variables`, `unconstrain_variables` and `unconstrain_draws` functions. These are then available as methods of the fitted model object. This requires the additional `Rcpp` and `RcppEigen` packages, which are not required for fitting models using CmdStanR.

Note: there may be many compiler warnings emitted during compilation but these can be ignored so long as they are warnings and not errors.

    init_model_methods(seed = 0, verbose = FALSE, hessian = FALSE)

## Arguments

seed

  (integer) The random seed to use when initializing the model.

verbose

  (logical) Whether to show verbose logging during compilation.

hessian

  (logical) Whether to expose the (experimental) hessian method.

## 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()
    #> Compiling additional model methods...
    # }