
Check Optional Software for Bayesian Scale Models
Source:R/bayes_scale_setup.R
check_bayes_setup.RdCheck whether the R packages that a multiScale_bayes() computation
method needs can be loaded and meet the package's minimum versions.
Nothing is installed, no model is fitted, and neither the compiler nor
sampling performance is tested.
Arguments
- method
Computation method to check, as in
multiScale_bayes()."sample"(default, NUTS) needs RTMB, tmbstan, rstan, and posterior."laplace"and"marginal"need RTMB."slice"and"prepare"need no optional packages to run in one process. Slice chain diagnostics need posterior (version 1.6.0 or later).- correction
"none"(default) or"importance". Importance correction applies only tomethod = "marginal"and also needs posterior.- cores
Requested number of worker processes; default 1. A value greater than one also checks processx, which parallel fits need. It has no effect for
"prepare", which always uses one process.- x
A
multiScaleR_bayes_setupobject fromcheck_bayes_setup().- ...
Not used. Supplying any further argument is an error.
Value
An object of class multiScaleR_bayes_setup, a list with these
elements.
method,correction: the settings checked.ready:TRUEwhen every listed package loads and meets its minimum version.packages: a data frame with one row per package and columnspackage,minimum(the minimum version, orNAwhen any version works), installedversion,loadable,meets_version,passed, and a diagnosticmessagethat says what to install or update.notes: what the check does and does not cover.
Printing the object lists the packages and the notes, and returns it invisibly. A passed check does not certify a working compiler, successful sampling, convergence, or adequate memory. Fit a small model next.
Details
Preparation (method = "prepare") validates your data and
formulas before you install any sampling software. Installing the NUTS
packages from source can require a C++ compiler, which on Windows comes
with Rtools. vignette("v13-bayesian-scales", package = "multiScaleR")
covers installation, and
vignette("v15-bayesian-computation", package = "multiScaleR") compares
the methods.
Examples
check_bayes_setup(method = "prepare") # always ready: nothing to install
#> Bayesian package setup: prepare
#> Package checks passed.
#> Preparation needs no optional Bayesian packages.
#> Checks R packages only; does not install software or run a model.
#> Compiler configuration, memory and sampling diagnostics require a separate small fit.
# Packages for slice sampling on two workers. `ready` is FALSE when
# processx is missing. The message column says what to install.
setup <- check_bayes_setup(method = "slice", cores = 2)
setup$ready
#> [1] TRUE
setup$packages[c("package", "loadable", "passed")]
#> package loadable passed
#> 1 processx TRUE TRUE