JAGS_check_convergence {BayesTools} | R Documentation |
Assess convergence of a runjags model
Description
Checks whether the supplied runjags-package model satisfied convergence criteria.
Usage
JAGS_check_convergence(
fit,
prior_list,
max_Rhat = 1.05,
min_ESS = 500,
max_error = 0.01,
max_SD_error = 0.05
)
Arguments
fit |
a runjags model |
prior_list |
named list of prior distribution (names correspond to the parameter names) |
max_Rhat |
maximum R-hat error for the autofit function.
Defaults to |
min_ESS |
minimum effective sample size. Defaults to |
max_error |
maximum MCMC error. Defaults to |
max_SD_error |
maximum MCMC error as the proportion of standard
deviation of the parameters. Defaults to |
Value
JAGS_check_convergence
returns a boolean
indicating whether the model converged or not, with an
attribute 'errors' carrying the failed convergence checks (if any).
See Also
Examples
## Not run:
# 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)
## End(Not run)
[Package BayesTools version 0.2.17 Index]