Error from Bayesian model by brms

I am following the code to test a Bayesian model here: Basic Bayesian examples

When running code

library(brms)
jill=brm(Murder ~ Assault*Rape*UrbanPop, data=USArrests, cores=4)

got error message below:
Error in compileCode(f, code, language = language, verbose = verbose) :
C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file5d847de82c9c.o:file5d847de82c9c.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file5d847de82c9c.o:file5d847de82c9c.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file5d847de82c9c.o:file5d847de82c9c.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file5d847de82c9c.o:file5d847de82c9c.cpp:(.text$_ZN3tbb10interface
Error in sink(type = "output") : invalid connection

Don't know what is wrong, I would appreciate very much if anyone can help fix the issue. Thank you!

Still got error message:

Error in sink(type = "output") : invalid connection

Maybe try installing R Interface to CmdStan • cmdstanr (mc-stan.org) and running brms with that?

e.g. in this example? A guide to working with country-year panel data and Bayesian multilevel models | Andrew Heiss making sure to run cmdstanr::install_cmdstan().

1 Like

Installed, but doesn't work, thank you!

when loading package brms, it reminds ar was masked, not sure if that caused the problem.

library(brms)
Loading required package: Rcpp
Loading 'brms' package (version 2.19.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').

Attaching package: ‘brms’
The following object is masked from ‘package:stats’: ar

Install rstan can fix the issue:
install.packages("rstan", repos = c("Repository for distributing (some) stan-dev R packages | r-packages", getOption("repos")))

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.