SBC_test {mcmcsae} | R Documentation |
Simulation based calibration
Description
Simulation based calibration
Usage
SBC_test(
...,
pars,
n.draws = 25L,
n.sim = 20L * n.draws,
burnin = 25L,
thin = 2L,
show.progress = TRUE,
verbose = TRUE,
n.cores = 1L,
cl = NULL,
seed = NULL,
export = NULL
)
Arguments
... |
passed to |
pars |
named list with univariate functions of the parameters to use in test. This list
is passed to argument |
n.draws |
number of posterior draws to retain in posterior simulations. |
n.sim |
number of simulation iterations. |
burnin |
burnin to use in posterior simulations, passed to |
thin |
thinning to use in posterior simulations, passed to |
show.progress |
whether a progress bar should be shown. |
verbose |
set to |
n.cores |
the number of cpu cores to use. Default is one, i.e. no parallel computation.
If an existing cluster |
cl |
an existing cluster can be passed for parallel computation. If |
seed |
a random seed (integer). For parallel computation it is used to independently seed RNG streams for all workers. |
export |
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. |
Value
A matrix with ranks.
References
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.
Examples
## Not run:
# 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"),
sigma.mod=pr_invchisq(df=1, scale=list(df=1, scale=1)), data=dat,
pars=list(mu="beta[1]", beta_x="beta[2]", sigma="sigma_"),
n.draws=9L, n.sim=10L*20L, thin=2L, burnin=20L
)
ranks
## End(Not run)