Learn R Programming

mcmcsae (version 0.7.4)

SBC_test: 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
)

Value

A matrix with ranks.

Arguments

...

passed to create_sampler (can be all parameters except prior.only)

pars

named list with univariate functions of the parameters to use in test. This list is passed to argument pred of MCMCsim.

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 MCMCsim.

thin

thinning to use in posterior simulations, passed to MCMCsim.

References

S. Talts, M. Betancourt, D. Simpson, A. Vehtari and A. Gelman (2018). Validating Bayesian inference algorithms with simulation-based calibration. arXiv:1804.06788.

Examples

Run this code
if (FALSE) {
# this example takes a long time
n <- 10L  # data size
dat <- data.frame(x=runif(n))
SBC_test(~ reg(~ 1 + x, b0=c(0.25, 1), Q0=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=25L, n.sim=100L*25L, thin=3L, burnin=50L
)
}

Run the code above in your browser using DataLab