SBC_test: Simulation based calibration

View source: R/sbc.R

SBC_testR 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
)

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.

Value

A matrix with ranks.

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

## Not run: 
# this example takes a long time
n <- 10L  # data size
dat <- data.frame(x=runif(n))
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=25L, n.sim=100L*25L, thin=3L, burnin=50L
)

## End(Not run)


mcmcsae documentation built on Oct. 11, 2023, 1:06 a.m.