JAGS_check_convergence | R Documentation |
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
)
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 |
JAGS_check_convergence
returns a boolean
indicating whether the model converged or not, with an
attribute 'errors' carrying the failed convergence checks (if any).
JAGS_fit()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.