I’m working on a bivariate model using the BRMS package (version 2.16.3)and I need to see the genetic and phenotypic correlation between two parameters tbm and ftbm using this package.I also have other parameters where there is a difference of fixed factors introduced in the model.
Unfortunately, I cannot find the following elements in my result:
cor(tbm, ftbm) is missing
nor at the level of:
VarCorr(brms_tbm_ftbm) where $animal$cor and $animal$cov are absent
Do you have any explanations for these results?
The model is written as follows:
bf_tbm ← bf(tbm ~ G + eleveur:G + year + sexe + mode_naissance + mother_age + saison_naissance + (1 | gr(animal, cov = A)))
bf_ftbm ← bf(ftbm ~ G + eleveur:G + year + sexe + mode_naissance + mother_age + saison_naissance + (1 | gr(animal, cov = A)))
brms_tbm_ftbm ← brm( bf_tbm + bf_ftbm + set_rescor(TRUE), data = data, data2 = list(A = A),
family = gaussian(), cores = 5)
Thank you in advance for your help in understanding the source of these absences.
I think you need to specify what effects you want the correlation for. So for the genetic correlation, you need explicitly mention that using the
(params | correlation | group) syntax, see the multivariate vignette: Estimating Multivariate Models with brms • brms
(1 | gr(animal, cov = A)) should be e.g.
(1 | p |gr(animal, cov = A)).
Thank you very much for your answer which perfectly meets my needs. This reworking in the code will also allow me to calculate the phenotypic correlation which corresponds to the sum of the genetic and residual correlations. I would also like to make sure this is correct:
rP = rA + rE where rA = cor(tbm, ftbm) and rE = rescor(tbm,ftbm)
because the calculations take a lot of time given that I have a lot of records and any error is difficult to catch up!
Once again thank you to you and for this magnificent exchange site
I don’t think you can simply sum the correlations like that. See e.g. equation 1 in this paper: https://onlinelibrary.wiley.com/doi/10.1111/j.1558-5646.1988.tb02514.x
You are right, I had taken the first equation of this course note without worrying about the details!
Once again, thank you very much for your availability and the speed of your responsiveness.