Spatial autocorrelation with categorical response variable


When accounting for spatial autocorrelation in a model with categorical response variable, I have this error:

Error: Explicit covariance terms can only be specified on 'mu'.

Any clue how to fix this?

I fitted the model as follow:

  fit  <- brm(y ~ x + (1|p|Id) + sar(W), data = dt, data2 = list(W = W), family  = categorical())

I don’t have the error when I fit the spatial autocorrelation with for instance a guassian response.


  • Operating System: Windows 10
  • brms Version: 2.13.0

the categorical family has multiple mu parameters and cannot be combined with sar correlation in general. Apologies for the unclear error message.

Ok thanks @paul.buerkner!

Does it mean that it is not possible to account for temporal/spatial autocorrelation in brms when the categorical family is used?

You have other correction structures to try out such as ar() or sar() I am not sure if they work with categorical models right now though.

ok thanks!