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
bf_Trait1 and the
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.
- Operating System: Windows 10
- brms Version: 2.10.0