Skip to contents

Load and compile the nowcasting model

Usage

enw_model(
  model = system.file("stan", "epinowcast.stan", package = "epinowcast"),
  include = system.file("stan", package = "epinowcast"),
  compile = TRUE,
  threads = TRUE,
  profile = FALSE,
  target_dir = epinowcast::enw_get_cache(),
  stanc_options = list(),
  cpp_options = list(),
  verbose = TRUE,
  ...
)

Arguments

model

A character string indicating the path to the model. If not supplied the package default model is used.

include

A character string specifying the path to any stan files to include in the model. If missing the package default is used.

compile

Logical, defaults to TRUE. Should the model be loaded and compiled using cmdstanr::cmdstan_model().

threads

Logical, defaults to TRUE. Should the model compile with support for multi-thread support in chain. Note that setting this will produce a warning that threads_to_chain is set and ignored. Changing this to FALSE is not expected to yield any performance benefits even when not using multithreading and thus not recommended.

profile

Logical, defaults to FALSE. Should the model be profiled? For more on profiling see the cmdstanr documentation. # nolint

target_dir

The path to a directory in which the manipulated .stan files without profiling statements should be stored. To avoid overriding of the original .stan files, this should be different from the directory of the original model and the include_paths.

stanc_options

A list of options to pass to the stanc_options of cmdstanr::cmdstan_model(). By default nothing is passed but potentially users may wish to pass optimisation flags for example. See the documentation for cmdstanr::cmdstan_model() for further details.

cpp_options

A list of options to pass to the cpp_options of cmdstanr::cmdstan_model(). By default nothing is passed but potentially users may wish to pass optimisation flags for example. See the documentation for cmdstanr::cmdstan_model() for further details. Note that the threads argument replaces stan_threads.

verbose

Logical, defaults to TRUE. Should verbose messages be shown.

...

Additional arguments passed to cmdstanr::cmdstan_model().

Value

A cmdstanr model.

See also

Examples

if (FALSE) { # interactive()
mod <- enw_model()
}