Hi, I’ve spent the past week going through all these forum posts, vignettes, google etc and still cannot find an answer for my problem. I’m hoping someone can help clarify.

I am building a mixed MLM model- the linear component of the model is already working. My data consists of 1 response variable (Resp_var, continuous), subject ID (ID_var, factor), grouping variable (Group_var, 4 level factor), a time variable (Time_var, continuous), and another covariate (CoVar, continuous but unique to each subject as a baseline value, doesn’t depend on time). My linear MLM syntax is:

```
Mod <- brm(Resp_var ~ (Time_var|Group_var) +
(CoVar* Group_var) + (Group_var|Id_var),
data = dat)
```

My two intercept represent ` (Time_var|Group_var)`

: the s random Group effect for time parameter and ` (Group_var|Id_var)`

: the subjects random effects per Group.

Based on prior research/knowledge of the subject we’re studying, we know we need to add on a nonlinear piece to accurately capture the Resp_var Similar to other research performed on this topic, the nonlinear component is modeled as a Weibull decay curve in this format (t/λ)^k, where t= Time_var), λ = scale param, k = shape param. I don’t know the values of λ (but due to the decay <0), and k (except 0<k<1). So the NL component I wish to add on is `(newtime / lambda) ^ kappa`

.

I’ve searched the forums and particular these github links: 46, 47 where @paul.buerkner explains how to incorporate a NL component into a linear model, and followed the examples, but none of the syntaxes I’ve tried have worked. Because my Grouping variable is a 4 level factor, I know I can only put in into the nonlinear listing, but I keep getting errors.

Here is one syntax I tried, going off of the information on those two links (where b1=lambda, b2= kappa)

```
brm(formula = Resp_var ~ b - I((Time_var / b1) ^ b2), data = dat,
nonlinear = list(b ~ (Gr_var | Id_var) + CoVar * Gr_var + (Time_var|Gr_var),
b1 ~ 1, b2 ~ 1),
prior=c(set_prior("normal(0,10)", nlpar="b"),
set_prior("uniform(0,1)", nlpar="b2", lb=0, ub=1),
set_prior("cauchy(0,10)", nlpar="b1", ub=0)))
```

Which brings up the error “Error: The following variables are missing in ‘data’:

‘b’”

I’ve tried using several other syntaxes and would come up with similar errors. I was able to use the same syntax and get the priors to work:

```
my_prior <- brms::get_prior(
brms::bf(Resp_var ~ b -((Time_var/b1)^b2),
nonlinear= list(b ~ (Time_var|Gr_var) + CoVar:Gr_var + (Gr_var|Id_var),
b1 ~ 1, b2 ~ 1),
nl=TRUE),
data= dat,
family = gaussian())
```

My apologies, as this is clinical data, I can’t share my dataset but if it would be helpful I can recreate a fake one.

- Operating System: Windows 10, R studio 1.4.1103
- brms Version: 2.14.4