This function fits a stan model using the light-weight interface provided by cmdstanr. The code was adapted from McElreath rethinking package.
Arguments
- model_code
A
character
pointing to the stan modelling code.- data
A
list
with all the parameters required to run the model_code in stan.- algorithm
A
character
giving the algorithm to use. Either'sampling'
(Default),'optimize'
or'variational'
for penalized likelihood estimation.- chains
A
numeric
indicating the number of chains to use for estimation.- cores
Number of threads for sampling. Default set to
'getOption("ibis.nthread")'
. Seeibis_options()
.- threads
numeric
giving the number of threads to be run per chain. Has to be specified in accordance with cores.- iter
A
numeric
value giving the number of MCMC samples to generate.- warmup
numeric
for the number of warm-up samples for MCMC. Default set to 1/2 of iter.- control
A
list
with further control options for stan.- cpp_options
A
list
with options for the Cpp compiling.- force
logical
indication whether to force recompile the model (Default:FALSE
).- path
character
indicating a path to be made available to the stan compiler.- save_warmup
A
logical
flag whether to save the warmup samples.- ...
Other non-specified parameters.