New user here!
In brms, we can impose spatial simultaneous autoregressive (SAR) structures on residuals using cor_errorsar
with a spatial weighting matrix W
, as follows:
brm(y ~ x, autocor = cor_errorsar(W))
Suppose that my data were grouped into, say, 10 groups, and my spatial weighting matrix was actually a 10x10 matrix specifying the spatial relationships between groups.
If I wanted to deal with grouping using random intercepts, could I continue to use cor_errorsar
to deal with spatial relationships between groups? Perhaps by expanding my 10x10 matrix into a larger one, such that all individuals within the same group have identical spatial weights?
brm(y ~ x + (1 | group), autocor = cor_errorsar(W))
Or would I have to resort to another method, such as cov_ranef
? Though I get the impression that this argument takes covariance matrices, not spatial weighting matrices.
Many thanks in advance!