Error using brm_multiple() function

Please also provide the following information in addition to your question:

  • Operating System: Windows
  • brms Version:2.12

I have been following the vignette for missing data analysis in brms. When running the model with multiple_brm() I received the following error:

imp <- mice(dat, m = 5, print = FALSE)

and then the modeling step

Model1 <- brm_multiple(Choice1 ~ 1 + Randomization + Phase + Session + Randomization:Condition:Phase + (1 | ID),
data = imp,
family=categorical(link = “logit”),
seed = 123,
prior = priors
)

Registry key ‘SOFTWARE\R-core\Rtools’ not found

When I run the model on the original data, I have no problems. I wondered if I had done something wrong because the compiling step

Rows containing NAs were excluded from the model. Compiling the C++ model

removed rows with NA? Is that normal for this type of model?

brms is running Stan in the background so if there are any NA’s like in the mice data then the rows will be dropped before running it. The imputed data should run without that error.

Can you post your full code? I see that you have prior = priors.

I suspect this might be a Windows R install error since it can’t find Rtools.

@Ara_Winter than you for your help. Below is the code:

imp <- mice(dat, m = 5, print = FALSE)

Then check and set the priors

get_prior(Choice1 ~ 1 + Randomization + Phase + Session + RandomizationConditionPhase + (1 | ID),
data = temp1,
family=categorical(link = “logit”),
prior = priors
)

priors <- c(prior(student_t(3, 1.5, 10), class = “Intercept”, dpar = “mu1”),
prior(student_t(3, .5, 10), class = “Intercept”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “ConditionPlatable”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “PhaseExtinction”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “PhaseExtinction:ConditionPlatable”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “RandomizationB”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:ConditionPlatable”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:PhaseExtinction”, dpar = “mu1”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:PhaseExtinction:ConditionPlatable”, dpar =“mu1”),
prior(normal(0,5), class = “b”, coef = “SessionPostMTx”, dpar =“mu1”),
prior(normal(0,5), class = “b”, coef = “ConditionPlatable”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “PhaseExtinction”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “PhaseExtinction:ConditionPlatable”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “RandomizationB”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:ConditionPlatable”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:PhaseExtinction”, dpar = “mu2”),
prior(normal(0,5), class = “b”, coef = “RandomizationB:PhaseExtinction:ConditionPlatable”, dpar =“mu2”),
prior(normal(0,5), class = “b”, coef = “SessionPostMTx”, dpar =“mu2”),
prior(student_t(3, 0, 5), class = “sd”, dpar = “mu1”),
prior(student_t(3, 0, 5), class = “sd”, dpar = “mu2”)
)

and the model

Model1 <- brm_multiple(Valence ~ 1 + Randomization + Phase + Session + Randomization:Condition:Phase + (1 | ID),
data = Imp,
family=categorical(link = “logit”),
seed = 123
prior = priors
)

generates the error noted as above.

Registry key ‘SOFTWARE\R-core\Rtools’ not found

traceback suggests that it happens when the modeling when compiling

31.makeRestartList(…)
30.withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) …
29…signalSimpleWarning(“running command ‘C:/PROGRA~1/R/R-36~1.1/bin/x64/R CMD SHLIB file2e844e4997a.cpp 2> file2e844e4997a.cpp.err.txt’ had status 314”, base::quote(system(cmd, intern = !verbose)))
28.system(cmd, intern = !verbose)
27.compileCode(f, code, language = language, verbose = verbose)
26.cxxfunction(sig = sig, body = body, plugin = plugin, includes = includes, settings = settings, …, verbose = verbose)
25.force(code)
24.withr::with_path(rtools_path(), code)
23.pkgbuild::with_build_tools(cxxfunction(sig = sig, body = body, plugin = plugin, includes = includes, settings = settings, …, verbose = verbose), required = rstan_options(“required”) && !identical(Sys.getenv(“WINDOWS”), “TRUE”) && !identical(Sys.getenv(“R_PACKAGE_SOURCE”), …
22.cxxfunctionplus(signature(), body = paste(" return Rcpp::wrap("", model_name, “”);", sep = “”), includes = inc, plugin = “rstan”, save_dso = save_dso | auto_write, module_name = paste(“stan_fit4”, model_cppname, “_mod”, sep = “”), verbose = verbose)
21…fun(model_code = .x1) at #1
20.eval(expr, envir, …)
19.eval(expr, envir, …)
18.eval2(call, envir = args, enclos = parent.frame())
17.do_call(rstan::stan_model, stan_model_args)
16.eval(expr, envir)
15.eval(expr, envir)
14.eval(expr, pf)
13.eval(expr, pf)
12.withVisible(eval(expr, pf))
11.evalVis(expr)
10.utils::capture.output(out <- eval(expr, envir), type = type, …)
9.eval_silent(do_call(rstan::stan_model, stan_model_args), silent = silence_stan_model, type = “message”)
8…fun(formula = .x1, data = .x2, family = .x3, prior = .x4, data2 = .x5, autocor = .x6, cov_ranef = .x7, sample_prior = .x8, sparse = .x9, knots = .x10, stanvars = .x11, stan_funs = .x12, seed = .x13, chains = .x14) at #1
7.eval(expr, envir, …)
6.eval(expr, envir, …)
5.eval2(call, envir = args, enclos = parent.frame())
4.do_call(brm, args)
3.withCallingHandlers(expr, message = function© invokeRestart(“muffleMessage”))
2.suppressMessages(do_call(brm, args))
1.brm_multiple(Choice1 ~ 1 + Randomization + Phase + Session + Randomization:Condition:Phase + (1 | ID), data = DisgustImpute, family = categorical(link = “logit”), seed = 123, )

1 Like

There a number of threads on here with Rtools error. I am not sure which one will be most helpful. I know a few folks install Stan from the dev version off of github others changed their Windows path names to have no spaces, others changed their build options RStan Always trying to download RTools when it's already installed

I am hoping someone who runs on Windows can jump in here and help out.