
Simulation based calibration
SBC_test(
...,
pars,
n.draw = 25L,
n.sim = 20L * n.draw,
burnin = 25L,
thin = 2L,
show.progress = TRUE,
verbose = TRUE,
n.cores = 1L,
cl = NULL,
seed = NULL,
export = NULL
)
A matrix with ranks.
passed to create_sampler
(can be all parameters except prior.only
)
named list with univariate functions of the parameters to use in test. This list
is passed to argument pred
of MCMCsim
.
number of posterior draws to retain in posterior simulations.
number of simulation iterations.
burnin to use in posterior simulations, passed to MCMCsim
.
thinning to use in posterior simulations, passed to MCMCsim
.
whether a progress bar should be shown.
set to FALSE
to suppress messages.
the number of cpu cores to use. Default is one, i.e. no parallel computation.
If an existing cluster cl
is provided, n.cores
will be set to the number
of workers in that cluster.
an existing cluster can be passed for parallel computation. If NULL
and
n.cores > 1
, a new cluster is created.
a random seed (integer). For parallel computation it is used to independently seed RNG streams for all workers.
a character vector with names of objects to export to the workers. This may be needed for parallel execution if expressions in the model formulae depend on global variables.
M. Modrak, A.H. Moon, S. Kim, P. Buerkner, N. Huurre, K. Faltejskova, A. Gelman and A. Vehtari (2023). Simulation-based calibration checking for Bayesian computation: The choice of test quantities shapes sensitivity. Bayesian Analysis, 1(1), 1-28.
if (FALSE) {
# this example may take a long time
n <- 10L
dat <- data.frame(x=runif(n))
ranks <- SBC_test(~ reg(~ 1 + x, prior=pr_normal(mean=c(0.25, 1), precision=1), name="beta"),
family=f_gaussian(var.prior=pr_invchisq(df=1, scale=list(df=1, scale=1))),
data=dat,
pars=list(mu="beta[1]", beta_x="beta[2]", sigma="sigma_"),
n.draw=9L, n.sim=10L*20L, thin=2L, burnin=20L
)
ranks
}
Run the code above in your browser using DataLab