| bmm_setup | R Documentation |
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.
bmm_setup(smoke_test = TRUE, backend = getOption("brms.backend", NULL))
smoke_test |
Logical. Compile and sample a small test model? Defaults
to |
backend |
The backend to check, |
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.
bmm(), bmm_data_check()
# checks without compiling anything
bmm_setup(smoke_test = FALSE)
# compiles and samples a small model as well
bmm_setup()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.