kmbayes_parallel: Run multiple BKMR chains in parallel

Description Usage Arguments Value Examples

View source: R/parallel_funs.R

Description

Fit parallel chains from the kmbayes function. These chains leverage parallel processing from the future package, which can speed fitting and enable diagnostics that rely on multiple Markov chains from dispersed initial values.

Usage

1
kmbayes_parallel(nchains = 4, ...)

Arguments

nchains

number of parallel chains

...

arguments to kmbayes

Value

a "bkmrfit.list" object, which is just an R list object in which each entry is a "bkmrfit" object kmbayes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(111)
dat <- bkmr::SimData(n = 50, M = 4)
y <- dat$y
Z <- dat$Z
X <- dat$X
set.seed(111)
Sys.setenv(R_FUTURE_SUPPORTSMULTICORE_UNSTABLE="quiet")
future::plan(strategy = future::multiprocess, workers=2)
# only 50 iterations fit to save installation time
fitkm.list <- kmbayes_parallel(nchains=2, y = y, Z = Z, X = X, iter = 50,
  verbose = FALSE, varsel = TRUE)
closeAllConnections()

bkmrhat documentation built on Feb. 18, 2021, 1:09 a.m.