stan_opts {EpiNow2}R Documentation

Stan Options

Description

[Stable] Defines a list specifying the arguments passed to underlying stan backend functions via rstan_sampling_opts() and rstan_vb_opts(). Custom settings can be supplied which override the defaults.

Usage

stan_opts(
  samples = 2000,
  backend = "rstan",
  init_fit = NULL,
  return_fit = TRUE,
  ...
)

Arguments

samples

Numeric, default 2000. Overall number of posterior samples. When using multiple chains iterations per chain is samples / chains.

backend

Character string indicating the backend to use for fitting stan models. Currently only "rstan" is supported.

init_fit

[Experimental] Character string or stanfit object, defaults to NULL. Should an initial fit be used to initialise the full fit. An example scenario would be using a national level fit to parametrise regional level fits. Optionally a character string can be passed with the currently supported option being "cumulative". This fits the model to cumulative cases and may be useful for certain data sets where the sampler gets stuck or struggles to initialise. See init_cumulative_fit() for details.

This implementation is based on the approach taken in epidemia authored by James Scott.

return_fit

Logical, defaults to TRUE. Should the fit stan model be returned.

...

Additional parameters to pass underlying option functions.

Value

A list of arguments to pass to the appropriate rstan functions.

Author(s)

Sam Abbott

See Also

rstan_opts

Examples

# using default of rstan::sampling
stan_opts(samples = 1000)

# using vb
stan_opts(method = "vb")

[Package EpiNow2 version 1.4.0 Index]