Last chance! 50% off unlimited learning
Sale ends in
stanmodel
.
# S4 method for stanmodel
sampling(object, data = list(), pars = NA,
chains = 4, iter = 2000, warmup = floor(iter/2), thin = 1,
seed = sample.int(.Machine$integer.max, 1),
init = 'random', check_data = TRUE,
sample_file = NULL, diagnostic_file = NULL, verbose = FALSE,
algorithm = c("NUTS", "HMC", "Fixed_param"),
control = NULL, include = TRUE,
cores = getOption("mc.cores", 1L),
open_progress = interactive() && !isatty(stdout()) &&
!identical(Sys.getenv("RSTUDIO"), "1"),
show_messages = TRUE, …)
list
or environment
providing the data for the model or a character vector
for all the names of objects used as data.
See the Note section in stan
.NA
indicating all parameters in the model.
If include = TRUE
, only samples for parameters named in pars
are stored in the fitted results. Conversely, if include = FALSE
,
samples for all parameters except those named in pars
are
stored in the fitted results.iter
and the default is
iter/2
.as.integer
will be applied to it.
If as.integer
produces NA
, the seed is generated randomly.
The seed can also be specified as a character string of digits, such as
"12345"
, which is converted to integer.stan
.TRUE
. If TRUE
the data will be preprocessed; otherwise not.
See the Note section in stan
.tempdir()
is used.
When there are multiple chains, an underscore and chain number are appended
to the file name prior to the .csv
extension.tempdir()
is used. When there are multiple chains,
an underscore and chain number are appended to the file name prior to the
.csv
extension.TRUE
or FALSE
: flag indicating whether
to print intermediate output from Stan on the console, which might
be helpful for model debugging."NUTS"
(No-U-Turn sampler, Hoffman and Gelman 2011),
"HMC"
(static HMC), or "Fixed_param"
. The default and
preferred algorithm is "NUTS"
.list
of parameters to control the sampler's
behavior. See the details in the documentation for the control
argument
in stan
.TRUE
indicating
whether to include or exclude the parameters given by the
pars
argument. If FALSE
, only entire multidimensional
parameters can be excluded, rather than particular elements of them.mc.cores
option
to be as many processors as the hardware and RAM allow (up to the
number of chains).cores > 1
but is recommended to be TRUE
in interactive
use so that the progress of the chains will be redirected to a file
that is automatically opened for inspection. For very short runs, the
user might prefer FALSE
.TRUE
)
indicating whether to print the summary of Informational Messages to
the screen after a chain is finished or a character string naming a path
where the summary is stored. Setting to FALSE
is not recommended
unless you are very sure that the model is correct up to numerical
error.chain_id
, init_r
,
test_grad
, append_samples
, refresh
,
enable_random_init
. See the documentation in stan
.stanfit
representing
the fitted results. Slot mode
for this object
indicates if the sampling is done or not.sampling
signature(object = "stanmodel")
stanmodel
given the data, initial values, etc.
,
, stan