Brms ID-syntax in multivariate model

Hi,
I’m estimating a multivariate model with two grouping terms in which different outcomes are predicted by some shared predictors as well as one predictor that differs between all formulas. So far, I have been using the |ID|-Syntax to model group-level terms as correlated. However, I am not actually sure what the reason behind this is and whether it should always be done or not. It would be great if someone could explain this in more detail. My syntax looks somewhat like this

bf_1 <- bf(y1 ~ 0 + Intercept + y1lagged + x1 + x2 + x3 + (0 + Intercept + y1lagged + x1 + x2 + x3 |ID1| Teach) + (0 + Intercept + y1lagged + x1 + x2 + x3 |ID2| Class), family = skew_normal())

bf_2 <- bf(y2 ~ 0 + Intercept + y2lagged + x1 + x2 + x3 + (0 + Intercept + y2lagged + x1 + x2 + x3 |ID1| Teach) + (0 + Intercept + y2lagged + x1 + x2 + x3 |ID2| Class), family = skew_normal())

bf_3 <- bf(y3 ~ 0 + Intercept + y3lagged + x1 + x2 + x3 + (0 + Intercept + y3lagged + x1 + x2 + x3 |ID1| Teach) + (0 + Intercept + y3lagged + x1 + x2 + x3 |ID2| Class), family = skew_normal())

model <- brm(bf_1 + bf_2 + bf_3, data=data)

When should I use the ID-Syntax and when is the simple “|” enough?
Thanks

Can anyone help? Even if it’s just an idea?

Hi,

do you want to estimate the correlation between group level effects? As @paul.buerkner writes in the help file ?brmsformula:

All group-level terms sharing the same ID will be modeled as correlated. If, for instance, one specifies the terms (1+x|2|g) and (1+z|2|g) somewhere in the formulas passed to brmsformula , correlations between the corresponding group-level effects will be estimated.

Thanks for your reply.
I’m not sure if I should estimate the correlations or not. That’s my main question. I know what the formula does, but I’m not sure if I should always use it, kind of as a default.

I would suggest using both (one where you use it and one where you don’t use it) and see if that helps (I have no idea if it can) with the out of sample prediction (i.e., use LOO or WAIC)?

Thanks I will try that. And do you by any chance know if estimating the correlations is related to power? I already have quite a lot of variables for my sample so just wondering if this should be taken into account as well…

Always include (estimate) the correlations if you can afford it (i.e. if the sampler converges in reasonable time). Otherwise you may lose importance sources of information in the model.

1 Like

Thank you!

@paul.buerkner I’ve not tried it myself but can you say from the top of your head if add correlations help with out of sample predictions?

I would expect it to help!