Syntax error for multivariate mixed effects model using cmdstanr backend

Here is the r code. Loaded newest version of brms, cmdstanr, and cmdstan

bfs=bf(phasic|mi()~mi(rum.state.lag1)+mi(tonic.state.lag1)+mi(phasic.state.lag1)+mi(imean.tonic)+mi(imean.rum)+(1|workerid))+
    bf(tonic|mi()~mi(rum.state.lag1)+mi(tonic.state.lag1)+mi(phasic.state.lag1)+mi(imean.phasic)+mi(imean.rum)+(1|workerid))+
    bf(rrs|mi()~mi(rum.state.lag1)+mi(tonic.state.lag1)+mi(phasic.state.lag1)+mi(imean.phasic)+mi(imean.tonic)+(1|workerid))+
    bf(rum.state.lag1|mi()~(1|workerid))+
    bf(tonic.state.lag1|mi()~(1|workerid))+
    bf(phasic.state.lag1|mi()~(1|workerid))+
    bf(imean.tonic|mi()~1)+
    bf(imean.phasic|mi()~1)+
    bf(imean.rum|mi()~1)+set_rescor(T)
bmod=brm(bfs,data=daily1.new,chains=4,iter=5000,cores=4)

Here’s the error message:

Syntax error in '/var/folders/zv/jdmt993x1d5_5_k3ngk7y9g00000gn/T/RtmpJyvQtl/model_2cf1b649207acfbb95b53be4864d3a66.stan', line 212, column 20 to column 21, parsing error:
   -------------------------------------------------
   210:      // vector combining observed and missing responses
   211:      vector[N_imeanrum] Yl_imeanrum = Y_imeanrum;
   212:      vector[nresp] Yl[N] = Y;
                             ^
   213:      // initialize linear predictor term
   214:      vector[N_phasic] mu_phasic = rep_vector(0.0, N_phasic);
   -------------------------------------------------

";" or plain assignment expected after variable declaration.

Error: Syntax error found! See the message above for more information.

Without specifying cmdstanr as backend, the model seems to compile okay, just running slowly.

Additional question… would it be possible to model residual correlation ignoring residuals at time 1?

  • Operating System: Mac OS
  • brms Version: 2.20.4

please try to install brms from github.

Thanks! This solved the issue and it compiles okay now.