sorry for sending this incomplete message:

the variable cluster is an Id for the farm where the animals come from, X_1 to X_5 are binary variables (0/1), Test is the imperfect test to assess disease (binary as 0/1) for assessing the probability of being sick §.

I then tried to implement the following coding for the 1st 2 covariables X_1 and X_2 as you previously suggested:

bform <- bf(

#Consol ~ y,

Test ~ y,

nlf(y ~ p * Se + (1 - p) * (1 - Sp)),

nlf(p ~ inv_logit(Temp + X_1 + X_2 + (1|Cluster))),

# nlf(logit§ ~ Temp + X_1 + X_2 + (1|farm)),

Se ~ 1,

Sp ~ 1,

nl=TRUE,

family = bernoulli())

#then adding priors based on litterature findings

bprior <- set_prior(“beta(27.02, 7.92)”, nlpar = “Se”, lb = 0, ub = 1) +

set_prior(“beta(80.58, 6.08)”, nlpar = “Sp”, lb = 0, ub = 1) #priors from published papers

#then running the final model:

fit <- brm(bform, data = data, prior = bprior)

## I obtain the following error message:

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

error in ‘model24681a526818_file24685a48377’ at line 39, column 60

```
37: for (n in 1:N) {
38: // compute non-linear predictor values
39: nlp_p[n] = inv_logit(C_p_1[n] + C_p_2[n] + C_p_3[n] + (1|Cluster));
^
40: }
```

## PARSER EXPECTED: “)”

Error in stanc(model_code = paste(program, collapse = “\n”), model_name = model_cppname, :

failed to parse Stan model ‘file24685a48377’ due to the above error.

In addition: Warning message:

Rows containing NAs were excluded from the model.

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

error in ‘model246867a22943_file24685a48377’ at line 39, column 60

```
37: for (n in 1:N) {
38: // compute non-linear predictor values
39: nlp_p[n] = inv_logit(C_p_1[n] + C_p_2[n] + C_p_3[n] + (1|Cluster));
^
40: }
```

PARSER EXPECTED: “)”

Error in stanc(model_code = paste(program, collapse = “\n”), model_name = model_cppname, :

failed to parse Stan model ‘file24685a48377’ due to the above error.

#I’m not able to find what’s wrong with this message.

Thanks in advance for your advices!