 # Correlation between random intercept and residual in a multivariate model

Hi all,

I am wondering if there is a way to ask brms, in a multivariate model context, to calculate the correlation between the random intercept in model 1 and residuals in model 2?

For instance we have two univariate models such as:

bf_Trait1 <- bf(Trait1 ~ covariate + (1 | Individual)) + gaussian()
bf_Trait2 <- bf(Trait2 ~ covariate) + gaussian()


bf_Trait1 has repeated measured per Individual and bf_Trait2 has only one.

I want to estimate the correlation between sd(Intercept) of the group level Individual in bf_Trait1  and the Sigma in bf_Trait2 .

An alternative way to do this is to force the residual variance in bf_Trait2 to 0 and add a random intercept to bf_Trait2 such as:

bf_Trait1 <- bf(Trait1 ~ covariate + (1 |p| Individual)) + gaussian()
bf_Trait2 <- bf(Trait2 ~ covariate + (1 |p| Individual)) + gaussian()


and then just get the correlation between random intercepts of both models. Unfortunately, I did find how to force brms to set residual variance to 0. Apparently, it is planning to add a new function constant() to fix a prior to a constant value, but it doesn’t seem to be added to brms yet.

Thanks!

• Operating System: Windows 10
• brms Version: 2.10.0
1 Like

One way may be to restrict \sigma for Trait2 to 1, like this:

bf_Trait1 <- bf(Trait1 ~ covariate + (1 |p| Individual)) + gaussian()
bf_Trait2 <- bf(Trait2 ~ covariate + (1 |p| Individual), sigma~0) + gaussian()


\sigma is modeled on a log scale, and since e^0=1 it will be fixed to 1.

1 Like