Skip to contents

DenMark.stan, or DenMark-vararea.stan with vararea = TRUE, is looked up in getOption("denmark.stan_dir") and then in the stan folder of the installed package. The compiled model is cached for the R session. The executables of the packaged models are written to tools::R_user_dir("DenMark", which = "cache") (one subfolder per package version, because the library may be read-only), so that later sessions reuse them; any other Stan file is compiled next to itself.

Usage

denmark_model(
  stan_file = NULL,
  vararea = FALSE,
  force_recompile = FALSE,
  quiet = TRUE
)

Arguments

stan_file

Optional path to a Stan file, compiled instead of the packaged model.

vararea

Use the variable-area model DenMark-vararea.stan, the same model with one area offset log_grid_area per grid cell (used with a tissue boundary).

force_recompile

Recompile even if a compiled model is available.

quiet

Suppress the compiler output.

Value

A cmdstanr CmdStanModel object.

Examples

mod <- denmark_model()
mod$exe_file()
#> [1] "/home/runner/.cache/R/DenMark/0.9.0/DenMark"