# Syntax error for multivariate mixed effects model using cmdstanr backend

**URL:** <https://discourse.mc-stan.org/t/syntax-error-for-multivariate-mixed-effects-model-using-cmdstanr-backend/34509>\
**Category:** brms\
**Tags:** mixed-model, cmdstanr\
**Created:** [March 15, 2024, 8:24pm UTC](https://discourse.mc-stan.org/t/syntax-error-for-multivariate-mixed-effects-model-using-cmdstanr-backend/34509 "2024-03-15T20:24:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![QMmmmLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/qmmmmliu/32/18121_2.png) [@QMmmmLiu](https://discourse.mc-stan.org/u/QMmmmLiu)\
**Post date:** [March 15, 2024, 8:24pm UTC](https://discourse.mc-stan.org/t/syntax-error-for-multivariate-mixed-effects-model-using-cmdstanr-backend/34509/1 "2024-03-15T20:24:39Z")

</div>

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

```no-highlight
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:

```no-highlight
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

---

<div class="post-metadata">

**Author:** ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Post date:** [March 15, 2024, 8:59pm UTC](https://discourse.mc-stan.org/t/syntax-error-for-multivariate-mixed-effects-model-using-cmdstanr-backend/34509/2 "2024-03-15T20:59:36Z")

</div>

please try to install brms from github.

---

<div class="post-metadata">

**Author:** ![QMmmmLiu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/qmmmmliu/32/18121_2.png) [@QMmmmLiu](https://discourse.mc-stan.org/u/QMmmmLiu)\
**Post date:** [March 15, 2024, 9:10pm UTC](https://discourse.mc-stan.org/t/syntax-error-for-multivariate-mixed-effects-model-using-cmdstanr-backend/34509/3 "2024-03-15T21:10:26Z")

</div>

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