# Syntax/inferences for nested non-linear MLM

**URL:** <https://discourse.mc-stan.org/t/syntax-inferences-for-nested-non-linear-mlm/9141>\
**Category:** brms\
**Created:** [June 6, 2019, 6:56pm UTC](https://discourse.mc-stan.org/t/syntax-inferences-for-nested-non-linear-mlm/9141 "2019-06-06T18:56:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [June 11, 2019, 10:05am UTC](https://discourse.mc-stan.org/t/syntax-inferences-for-nested-non-linear-mlm/9141/5 "2019-06-11T10:05:27Z")

</div>

Breaking it into multiple formulas the way you did would imply a multivariate model, which we don’t have here. But if we just put the formulas in `f1` and `f2` into the same `bf` call, it should be close to working. The only thing that needs to be fixed is that a formula can either be parsed in a standard or non-linear manner. That is,

```
gamma ~ (1 | lev2cor | gamma_groupings) + mugamma

```

is invalid as it both contains standard parts and “non-linear” parts (`mugamma`). If you want an additional formula to be parsed in a non-linear manner, just wrap it in `nlf`, for instance `nlf(gamma ~ phi + mugamma`) and then `phi ~ (1 | lev2cor | gamma_groupings)`.

---

_[View the full topic](https://discourse.mc-stan.org/t/syntax-inferences-for-nested-non-linear-mlm/9141)._
