Error with fitting a correlation (genetic relatedness relatedness) matrix in brms

Dear all,

I am trying to use brms to create an animal model with a genetic relatedness matrix (a dgCMatrix to be exact), in a similar way that can be done in MCMCglmm.

If I’m not mistaken, I can do this using the cov argument in brms. I used the Phylogenetic Model vignette (https://cran.r-project.org/web/packages/brms/vignettes/brms_phylogenetics.html) to translate the ginverse option (used for genetic relatedness matrices) in MCMCglmm to brms using the following code:

library(brms); library(MCMCglmm)

# Load in my genetic relatedness model created with PLINK 
# --make-rel square 
# command
load("data/relmatrix/clean_relmatrix.RData")

# Convert to dgCmatrix
rel_dgCmatrix<-as(solve(relmatrix),"dgCMatrix")

# Load in phenotypes
pheno <- read.csv(phenotypes_example.csv") # id, site and LMS

# In MCMCglmm:
fit_mcmcglmm_1 <-MCMCglmm(LMS ~ 1,random=~id+site+dom,
                          ginverse= list(dom=rel_dgCmatrix),
                          data=pheno)

# Do the same thing in brms following the 
# [Vignette](https://cran.r-project.org/web/packages/brms/vignettes/brms_phylogenetics.html) 
# and [issue #26](https://github.com/paul-buerkner/brms/issues/26):

fit_lms_brms <- brm(LMS ~ 1 + (1|id) + (1|site) + (1|gr(dom, cov=rel_dgCmatrix)),
                   data2=list(rel_dgCmatrix = rel_dgCmatrix),
                    data=pheno_wide)

Even though it works perfectly fine in MCMCglmm, with brms I get the Error ‘Within-group covariance matrices must be symmetric.’. The matrix provided is symmetric and works in MCMCglmm, and I cannot figure out what the problem is with the matrix in brms. Has anyone come across a similar issue? I have attached the matrix and phenotype file.

phenotypes_example.csv (2.8 KB)
clean_relmatrix.RData (135.0 KB)

I am working with brms version 2.18.0, MCMCglmm version 2.34 in R Version 3.6.3 RStudio version 1.3.1093 on a Linux system.

I realize this is very late, but do keep in mind that MCMCglmm uses the inverse of the relatedness matrix, while brms uses the matrix directly (IIRC).