Hi all,

I just discovered brms and I want to fit a random-intercept multilevel model with spatial error correlation. I am using Rstudio in Windows and brms version 2.9.0. Let’s say I have a spatial data (land observation) that is nested in group B. The group B is further nested in group C, where several group B belongs to multiple group C. Here is where multi membership is needed. The oversimplified visualization is:

And here is the list of columns I have:

- 1 column of dependent variable Y
- 3 columns of predictors (A,B,C)
- 1 column for the ID of group B (group_Bid)
- 2 columns for specifying the ID of group C each group B belongs to (C_id1,C_id2)
- 2 columns for the weight of group C (W1,W2)

I have some questions regarding how to fit the code in brms:

- How should I model the 3-level multiple membership model in brms?

```
y ~ A + B + C + (1|groupB_id) + (1|mm(C_id1,C_id2), weights = cbind(W1,W2)) , ...
```

or

```
y ~ A + B + C + (1|groupB_id/mm(C_id1,C_id2), weights = cbind(W1,W2)) , ...
```

- If I want to consider for the spatial error autocorrelation in the error term of land observation, would adding

```
...autocor = cor_errorsar(W),...
```

to the code be enough? W is the matrix of the neighborhood relationship for each land to all other lands.

I want to calculate the spatial autocorrelation coefficient (rho), whether it is still significantly present in the observation-level error term, even after controlling with multilevel multi membership model structure.

Thank you for your time and attention on my question, in advance :)