Solving Error creating model in Rstan and brms

Hi all,

I defined the following model in R to perform a (simple) Bayesian Linear Mixed Model analysis:


Set priors

priors <- c(prior(normal(200, 1), class = Intercept), # intercept prior
prior(normal(4, 1), class = b), # slope prior
prior(normal(0, 100), class = sigma), # population variance
prior(normal(0, 10), class = sd) # tau0, group variance

Fit model

model <- brm(choice ~ 1 + C_growth_mindset + (1|id),
data = data,
prior = priors,
family = gaussian(),
warmup = 1000, # burn-in
iter = 5000, # number of iterations
chains = 2, # number of MCMC chains
control = list(adapt_delta = 0.95)) # advanced MC settings

However when running the model I receive the following error:
Error in compileCode(f, code, language = language, verbose = verbose) :
sh: line 1: c:/rtools40/mingw64/bin/g++: No such file or directorymake: *** [C:/PROGRA~1/R/R-41~1.3/etc/x64/Makeconf:245: file34d0683214e8.o] Error 127
Error in sink(type = "output") : invalid connection

How can I solve this?

Thank you for thinking with me :slight_smile:


is telling that there is no compiler were expected, possibly created with RTools. Sorry, not a windows guy, so can't tell you how. Try a search of this site for Rtools or g++

Thank you. It’s already solved by changing the package installation folder

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.