Specifying multi membership on level 3 in model with errorsar structure

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:

  1. 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)) , ... 


y ~ A + B + C + (1|groupB_id/mm(C_id1,C_id2), weights = cbind(W1,W2)) , ... 
  1. 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 :)

Hi sorry for not responding sooner.

  1. I think the first of the two formulas looks more reasonable to me.

  2. cor_sar structures are currently computationally very expensive and I would suggest using cor_car instead if possible.

1 Like

Thank you very much for your reply! And sorry for not replying in time.

I’ve read about your suggestions to use cor_car instead of cor_sar. I am currently reading some papers about the relationships between the CAR and SAR and still learning about how these two work and differ. Meanwhile, I have tried using cor_car instead for my analysis and it saves the computation time a lot compared to using cor_errorsar (I’ve run my analysis using cor_errorsar since 7 days ago but now it’s still in Chain 1: Iteration: 1 / 5000 [ 0%] (Warmup) phase)

While we’re on this topic, I want to ask you about the interchangeability of cor_car and cor_errorsar. My data seems to have spatial autocorrelation in the error structure. Do you think I could still capture the spatial autocorrelation effect if I use cor_car instead of cor_errorsar in my model?

I have actually computed my model using cor_car with this result:

Correlation Structures:
      Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
car       1.00      0.00     1.00     1.00       2133 1.00
sdcar     0.52      0.02     0.47     0.56        481 1.00

If they are interchangeable, how should I interpret this result related to the spatial autocorrelation in the error term?

Many thanks,

I don’t think they are interchangable but I prefer the CAR model for being factorizable (hence the drastic speedup). @Daniel_Simpson might have more insights on these different spatial correlation structures.