BRMS compilation error for certain group level effect specifications

#1
  • Operating System: Ubuntu 4.15.0-1035-aws
  • brms Version: 2.8.0
  • rstan Version: 2.18.9

I get a compilation error using brms for some models on a dataset but not others. See below:

    // Works
    out <- brms::brm(r | trials(n) ~ t, 
                        control = list(adapt_delta = 0.99), cores = 4, iter = 5000, family = binomial(), data =long_dat)

    //Works
    brms::brm(r | trials(n) ~  t + (-1 + t | study_id), 
                        control = list(adapt_delta = 0.99), cores = 4, iter = 5000, family = binomial(), data = long_dat)


    //Error
    brms::brm(r | trials(n) ~  t + (1 + t | study_id), 
                        control = list(adapt_delta = 0.99), cores = 4, iter = 5000, family = binomial(), data = long_dat)

Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/RcppEigen/include/Eigen/Core:383:0,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/RcppEigen/include/Eigen/Dense:1,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/StanHeaders/include/stan/math/rev/core.hpp:14,
from /home/tdisher/nma_validation/packrat/lib/x86_64-pc-linux-gnu/3.5.3/StanHeaders/includ
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘/usr/lib/R/bin/R CMD SHLIB file28502443d7d7.cpp 2> file28502443d7d7.cpp.err.txt’ had status 1
Error in sink(type = “output”) : invalid connection

I’m assuming I’m making an error somewhere? Tried installing stanheaders. Could it be a packrat issue?

#2

I don’t know what exactly is happening but perhaps @bgoodri does?

#3

I had a similar problem, but it was weirdly due to the working directory. Are you using some Box folder, or a network-based/aware FS directory as a working directory?

I have no idea why, but when I was using a Box directory (using rclone to sync), some brms/stan models would compile, others wouldn’t. I moved those out of the Box hierarchy, changed the working directory, and it was fine.

#4

Hmmm, we are using RStudio Server hosted on an AWS box but my working directory is just my user directory on that system so I don’t think this is the issue?

#5

This is similar to the question I just posted. I’m using Debian and receiving the exact same error.

If you put verbose = T in the call to Stan, what is the first error: notification in the output? You might need to save the result to a txt file first using capture.output(stan(..., verbose=T), 'filename.txt') to read the error message.