stan_opts {EpiNow2} | R Documentation |
Stan Options
Description
Defines a list specifying the arguments passed to underlying stan
backend functions via stan_sampling_opts()
and stan_vb_opts()
. Custom
settings can be supplied which override the defaults.
Usage
stan_opts(
object = NULL,
samples = 2000,
method = c("sampling", "vb", "laplace", "pathfinder"),
backend = c("rstan", "cmdstanr"),
init_fit = NULL,
return_fit = TRUE,
...
)
Arguments
object |
Stan model object. By default uses the compiled package
default if using the "rstan" backend, and the default model obtained using
|
samples |
Numeric, default 2000. Overall number of posterior samples. When using multiple chains iterations per chain is samples / chains. |
method |
A character string, defaulting to sampling. Currently supports MCMC sampling ("sampling") or approximate posterior sampling via variational inference ("vb") and, as experimental features if the "cmdstanr" backend is used, approximate posterior sampling with the laplace algorithm ("laplace") or pathfinder ("pathfinder"). |
backend |
Character string indicating the backend to use for fitting stan models. Supported arguments are "rstan" (default) or "cmdstanr". |
init_fit |
Character string or This implementation is based on the approach taken in epidemia authored by James Scott. This argument is deprecated and the default (NULL) will be used from the next version. |
return_fit |
Logical, defaults to TRUE. Should the fit stan model be returned. |
... |
Additional parameters to pass to underlying option functions,
|
Value
A <stan_opts>
object of arguments to pass to the appropriate
rstan functions.
See Also
stan_sampling_opts()
stan_vb_opts()
Examples
# using default of [rstan::sampling()]
stan_opts(samples = 1000)
# using vb
stan_opts(method = "vb")