A thorough introduction to Incremental Mixture Approximate Bayesian Computation (IMABC) method can be found in C. M. Rutter et al. (2019). Here we will walk through the code found in C. Rutter et al. (2022).
For a more detailed explanation of how the priors functions work, see
the vignette("priors")
priors <- define_priors(
# x1: Uniform Prior (from base R)
x1 = add_prior(
dist_base_name = "unif",
min = 0.2, max = 0.9
),
# x2: Truncated Normal (from truncnorm package)
add_prior(
parameter_name = "x2",
density_fn = "dtruncnorm",
mean = 0.5, sd = 0.05, a = 0.4, b = 0.8, # a = min and b = max
min = 0.4, max = 0.8 # User must specify both in truncnorm
),
# V3: Fixed parameter (not calibrated)
add_prior(0.5)
)
A more detailed description will be available in the near future at
vignette("targets")
A more detailed description will be available in the near future at
vignette("target_functions")
fn1 <- function(x1, x2) { x1 + x2 + sample(c(-1, 1), 1)*rnorm(1, 0, 0.1) }
fn2 <- function(x1, x2) { x1 * x2 + sample(c(-1, 1), 1)*rnorm(1, 0, 0.1) }
fn <- function(x1, x2) {
res <- c()
res["T2"] <- fn1(x1, x2)
res["T1"] <- fn2(x1, x2)
return(res)
}
target_fun <- define_target_function(
targets, priors, FUN = fn, use_seed = FALSE
)
The primary function is imabc(). The inputs and their descriptions are as follows:
calibration_results <- imabc(
priors = priors,
targets = targets_nogroup,
target_fun = target_fun,
seed = 54321,
N_start = 2000,
N_centers = 2,
Center_n = 500,
N_cov_points = 50,
N_post = 100
)