Description Usage Arguments Examples
Run an iterative process and collect a trace of the iterations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
param_init |
|
step_funs |
list“
|
fixed |
|
shared |
|
callbacks |
|
n_iter |
number of iterations |
n_chains |
number of separate chains to sample |
n_parallel |
number of parallel processes to run |
n_burn |
number of iterations out of |
n_skip |
keep every |
seeds |
vector of numbers or NULL; if not NULL, each of these is passed to each separate chain; if NULL these are picked automatically (and each chain has a different seed) |
read_cache |
if TRUE, will read the trace at the end of iterating
into R; else the samples will be left in the trace folder only — but
see |
clean_cache |
if TRUE, will delete any folder created to store samples |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## beta-binomial Gibbs sampling, multi-core
g <- itertracer(
fixed = list(n = 20L),
param_init = lapply(list(x = 10, theta = 0.5), as.array),
step_funs = list(
x = function(arg_list) {
rbinom(
n = 1,
size = arg_list[["fixed"]][["n"]],
prob = arg_list[["param_list"]][["theta"]]
)
},
theta = function(arg_list) {
rbeta(
n = 1,
shape1 = 2 + arg_list[["param_list"]][["x"]],
shape2 = 4 + arg_list[["fixed"]][["n"]] - arg_list[["param_list"]][["x"]]
)
}
),
n_chains = 1L,
n_iter = 300,
n_burn = 50L,
n_skip = 4L,
n_parallel = 1L
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.