Correlated random effects vs multivariate models

I have been looking through the brms ’ Estimating Multivariate Models with brms’ vignette, and I am trying to understand how the correlated random effects term works. For instance, lets look at a simple multivariate model where we estimate residual correlation:

library(brms)

r = matrix(c(1, 0.5,
              0.5, 1), 
            nrow = 2, ncol = 2, byrow = TRUE)
df = as.data.frame(MASS::mvrnorm(100, mu = c(0,0), Sigma = r))
df$id = c(1:100)

a = bf(V1 ~ 1)
b = bf(V2 ~ 1)
m = brm(a + b + set_rescor(T), data = df, chains = 1)
summary(m)

For more complex multivairate models, the vignette introduces the idea of using correlated random effects like (1|p|group). So my question, if we include an observation level random effect, is this comparable to the above model:

c = bf(V1 ~ 1 + (1|p|id))
d = bf(V2 ~ 1 + (1|p|id))
m2 = brm(c + d + set_rescor(F), data = df, chains = 1)
summary(m2)

My guess is that the answer is no, partly because the model looks outputs different, but also I can see a few small alterations to the stancode. Unfortunately I can’t intetrpret what the (1|p|group) term is actually doing. Would anyone be able to describe what’s going on in generic mathematical notation?

  • Operating System: MAC monterry M1
  • brms Version: 2.20.4
1 Like