Checks and lists settings for the JAGS_fit function.

JAGS_check_and_list_fit_settings(
  chains,
  adapt,
  burnin,
  sample,
  thin,
  autofit,
  parallel,
  cores,
  silent,
  seed,
  check_mins = list(chains = 1, adapt = 50, burnin = 50, sample = 100, thin = 1),
  call = ""
)

JAGS_check_and_list_autofit_settings(
  autofit_control,
  skip_sample_extend = FALSE,
  call = ""
)

Arguments

chains

number of chains to be run, defaults to 4

adapt

number of samples used for adapting the MCMC chains, defaults to 500

burnin

number of burnin iterations of the MCMC chains, defaults to 1000

sample

number of sampling iterations of the MCMC chains, defaults to 4000

thin

thinning interval for the MCMC samples, defaults to 1

autofit

whether the models should be refitted until convergence criteria specified in autofit_control. Defaults to FALSE.

parallel

whether the chains should be run in parallel FALSE

cores

number of cores used for multithreading if parallel = TRUE, defaults to chains

silent

whether the function should proceed silently, defaults to TRUE

seed

seed for random number generation by JAGS_fit(): an integer between -.Machine$integer.max and .Machine$integer.max. Draws are reproducible for the same seed, chains, and R random-number generator settings (RNGkind()), and, with parallel = TRUE, the same cores. Parallel draws need not equal serial draws with the same seed, because the backend passes each chain's initial state to its worker in a serialized text form. Initial values are drawn from the priors after set.seed(seed), and each chain's JAGS random-number seed is drawn from the same seed with sample.int(.Machine$integer.max, chains) (see JAGS_get_inits). A chain's JAGS seed therefore does not depend on the number of chains, but the JAGS generator does: with more than four chains it changes from "base::Super-Duper" to "lecuyer::RngStream", so the draws of a chain differ between fits with up to four and with more chains. The chains of adjacent seeds (e.g., seed and seed + 1) do not share random-number streams. Automatic restarts after a failed initialization (see restarts in autofit_control) draw their seeds from a separate stream of the same seed (the first L'Ecuyer-CMRG substream), so the i-th restart does not repeat the fit with seed + i. A seeded fit restores the caller's random-number state (.Random.seed and RNGkind()) when it returns. With seed = NULL, the initial values are drawn from one seed taken from the caller's random-number stream (see JAGS_get_inits), which the fit then continues to use.

check_mins

named list of minimal values for which should some input be checked. Defaults to:

chains

1

adapt

50

burnin

50

sample

100

thin

1

call

string to be placed as a prefix to the error call.

autofit_control

a list of arguments controlling the autofit function. Convergence thresholds and max_time$time must be finite and non-missing. Set a convergence threshold or max_time to NULL to disable that check. Possible options are:

max_Rhat

maximum R-hat error for the autofit function. Defaults to 1.05. R-hat is the larger of the point estimate and the upper confidence limit of the potential scale reduction factor, whereas the summary tables show the point estimate (see JAGS_check_convergence()).

min_ESS

minimum effective sample size. Defaults to 500.

max_error

maximum MCMC error. Defaults to 0.01.

max_SD_error

maximum MCMC error as the proportion of standard deviation of the parameters. Defaults to 0.05.

max_time

list with fields time and unit, specifying when the automatic fitting function is stopped. The unit value corresponds to the units argument of difftime.

max_extend

number of times after which the automatic fitting function is stopped.

sample_extend

number of samples between each convergence check. Defaults to 1000.

restarts

maximum number of fitting attempts when the model fails to initialize; every failed attempt but the last is retried with new initial values (restarts = 1 fits once, without a retry). A failed attempt that is retried is reported as a warning of the fit. Defaults to 10.

check_indicators

whether model indicator variables should be included in convergence checks, including when monitor selects a narrower parameter set. Auxiliary inclusion-probability coordinates remain excluded unless requested explicitly. Defaults to FALSE.

monitor

optional character vector selecting parameters for convergence checks. Base names select all indexed elements. Requests are resolved against the monitored nodes that the summary tables show, including the derived and auxiliary ones that the default selection excludes. Base names that are not monitored are rejected before sampling (error class BayesTools_parameter_not_found); an indexed element such as "mu[2]" is resolved against the fitted columns after the first run and fails then when it does not exist. Defaults to NULL, which checks the default selection of JAGS_check_convergence(): the sampled parameters of the priors, add_parameters that depend on a stochastic node, and the stochastic nodes that formulas monitor (such as latent random effects and LKJ primitives). Deterministic nodes that formulas monitor (such as random-effect correlation matrices and their Cholesky factors) are derived and not checked by default. The role of every fitted coordinate is stored in the convergence_role column of parameter_coordinates().

allow_not_assessable

whether undefined diagnostics for requested sampled parameters may be ignored. Defaults to FALSE.

skip_sample_extend

whether sample_extend is allowed to be NULL and skipped in the check

Value

JAGS_check_and_list_fit_settings invisibly returns a list of checked fit settings. JAGS_check_and_list_autofit_settings invisibly returns a list of checked autofit settings.