Usage
stan_model(file, model_name = "anon_model",
model_code = "", stanc_ret = NULL,
boost_lib = NULL, eigen_lib = NULL,
save_dso = TRUE, verbose = FALSE,
auto_write = rstan_options("auto_write"),
obfuscate_model_name = TRUE,
allow_undefined = FALSE, includes = NULL)
Arguments
file
A character string or a connection that R supports
specifying the Stan model specification in Stan's modeling language.
model_name
A character string naming the model; defaults
to "anon_model"
. However, the model name will be derived from
file
or model_code
(if model_code
is the name of a
character string object) if model_name
is not specified.
model_code
Either a character string containing the model
specification or the name of a character string object in the workspace.
This is an alternative to specifying the model via the file
or stanc_ret
arguments.
stanc_ret
A named list returned from a previous call to
the stanc
function. The list can be used to specify the model
instead of using the file
or model_code
arguments.
boost_lib
The path to a version of the Boost C++ library to
use instead of the one in the BH package.
eigen_lib
The path to a version of the Eigen C++ library to
use instead of the one in the RcppEigen package.
save_dso
Logical, defaulting to TRUE
, indicating
whether the dynamic shared object (DSO) compiled from the C++ code for the
model will be saved or not. If TRUE
, we can draw samples from
the same model in another R session using the saved DSO (i.e.,
without compiling the C++ code again).
verbose
Logical, defaulting to FALSE
, indicating whether
to report additional intermediate output to the console,
which might be helpful for debugging.
auto_write
Logical, defaulting to the value of
rstan_options("auto_write")
, indicating whether to write the
object to the hard disk using saveRDS
. Although this argument
is FALSE
by default, we recommend calling
rstan_options("auto_write" = TRUE)
in order to avoid unnecessary
recompilations. If file
is supplied and its dirname
is writable, then the object will be written to that same directory,
substituting a .rds
extension for the .stan
extension.
Otherwise, the object will be written to the tempdir
. obfuscate_model_name
A logical scalar that is TRUE
by default and
passed to stanc
. allow_undefined
A logical scalar that is FALSE
by default and
passed to stanc
. includes
If not NULL
(the default), then a character vector of
length one (possibly containing "\n"
) of the form
'#include "/full/path/to/my_header.hpp"'
, which will be inserted
into the C++ code in the model's namespace and can be used to provide definitions
of functions that are declared but not defined in file
or
model_code
when allow_undefined = TRUE