Checks whether the supplied runjags-package model satisfied convergence criteria.
JAGS_check_convergence(
fit,
prior_list,
max_Rhat = 1.05,
min_ESS = 500,
max_error = 0.01,
max_SD_error = 0.05,
add_parameters = NULL,
fail_fast = FALSE
)
a runjags model
named list of prior distribution (names correspond to the parameter names)
maximum R-hat error for the autofit function.
Defaults to 1.05
.
minimum effective sample size. Defaults to 500
.
maximum MCMC error. Defaults to 1.01
.
maximum MCMC error as the proportion of standard
deviation of the parameters. Defaults to 0.05
.
vector of additional parameter names that should be used (only allows removing last, fixed, omega element if omega is tracked manually).
whether the function should stop after the first failed convergence check.
JAGS_check_convergence
returns a boolean
indicating whether the model converged or not, with an
attribute 'errors' carrying the failed convergence checks (if any).
if (FALSE) { # \dontrun{
# simulate data
set.seed(1)
data <- list(
x = rnorm(10),
N = 10
)
data$x
# define priors
priors_list <- list(mu = prior("normal", list(0, 1)))
# define likelihood for the data
model_syntax <-
"model{
for(i in 1:N){
x[i] ~ dnorm(mu, 1)
}
}"
# fit the models
fit <- JAGS_fit(model_syntax, data, priors_list)
JAGS_check_convergence(fit, priors_list)
} # }