Fitting a model with bmm() needs a C++ toolchain (a compiler
and make) and a Stan backend, the software that turns the model into a
program and samples from it. There are two backends: the R package
cmdstanr, which runs CmdStan, a separate program installed with
cmdstanr::install_cmdstan(); and the R package rstan. rstan must
load with either backend, because brms uses it to store every fit.
bmm_setup() checks each of these, prints whether it passed, and gives
one fix for every check that failed. It does not install or change
anything.
Two checks concern the toolchain. "C++ toolchain" lets R compile a small
test file; "CmdStan toolchain" is cmdstanr's own check, which only looks
for make and a compiler on the PATH. The second can pass while the
first fails, e.g. on a Mac whose command line tools are missing, and the
first is the one that decides.
With smoke_test = TRUE, it finally compiles and samples a small
two-parameter mixture model (mixture2p()) through bmm(), on the
backend bmm() will use. This is the only check that shows the whole
chain works. On an Apple Silicon Mac it takes about 10 seconds with
cmdstanr and 45 seconds with rstan, and it is skipped when a check it
needs has failed. Once every check passes, rerun the bmm() call that
failed.
Usage
bmm_setup(smoke_test = TRUE, backend = getOption("brms.backend", NULL))Arguments
- smoke_test
Logical. Compile and sample a small test model? Defaults to
TRUE.- backend
The backend to check,
"cmdstanr"or"rstan". The default checks the backendbmm()would choose: thebrms.backendoption if it is set, otherwisecmdstanrwhenever thecmdstanrpackage is installed, even when CmdStan is not, andrstanotherwise.
Value
A data frame of class bmm_setup with one row per check and the
columns check, status ("pass", "fail" or "skip"), detail and
fix (NA unless the check failed). It prints as a report.
