Error when compiling Stan program through brms

I have been using brms for a while in R 3.5.3. A few days ago, the R on our server got upgraded to R 4.0.3. I installed brms in the new R through CRAN without any problem. However, when I tried the example code in Estimating Distributional Models with brms, I got an error when compiling the code (see attached screenshot below). My suspect is that this may be due to version issues but I don’t know the source of this. Does anybody have any idea?

Screen Shot 2021-01-18 at 9.45.07 PM

Below is the code (the same with the code in the link):

library(brms)
group <- rep(c("treat", "placebo"), each = 30)
symptom_post <- c(rnorm(30, mean = 1, sd = 2), rnorm(30, mean = 0, sd = 1))
dat1 <- data.frame(group, symptom_post)
fit1 <- brm(bf(symptom_post ~ group, sigma ~ group), 
            data = dat1, family = gaussian())

Here is the session info:

  • Operating System: Linux
  • brms Version: brms_2.14.4

Hi Yida,

The first thing to try is to restart R and reinstall RStan and StanHeaders from source:

install.packages(c("StanHeaders","rstan"),type="source")

If that doesn’t work, can you post the output from:

devtools::session_info("rstan")

It works! Can I ask what is the reason for this error? Thanks!