Skip to contents

Compiles one of the bundled Stan models and returns a CmdStanModel object. Use this to pre-compile a model before running multiple fits in parallel (e.g., on HPC).

Usage

compile_model(model = "presence_only", stan_threads = FALSE, ...)

Arguments

model

Character string specifying the model to compile. One of: "presence_only" (default), "bm_constant", "bm_evolving", "ou_constant", "ou_evolving", or "null".

stan_threads

Logical, whether to compile with threading support for reduce_sum parallelisation (default FALSE).

...

Additional arguments passed to cmdstanr::cmdstan_model().

Value

A CmdStanModel object.

Examples

if (FALSE) { # \dontrun{
mod <- compile_model("presence_only")
mod$exe_file()

mod_threads <- compile_model("bm_constant", stan_threads = TRUE)
} # }