I have now been working with phylogenetically corrected models in brms for the past two years. I noticed that the previously used cov_ranef function was now replaced with a grouping argument inside the gr function. However, when I tried the implement the same structure as the one I used with cov_ranef, I get the following error: Grouping structure ‘gr’ expects only a single grouping term. I am not well versed enough to understand specifically what it means as I only have one grouping factor in my very simple database. I therefore looked at the example that was posted in the phylogenetic vignette of brms and copied it into my R session. However, I still get the same error when trying to run the model… Would you be able to help me on how to solve this issue?
All the best!
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
phylo <- ape::read.nexus("https://paul-buerkner.github.io/data/phylo.nex") data_simple <- read.table( "https://paul-buerkner.github.io/data/data_simple.txt", header = TRUE ) A <- ape::vcv.phylo(phylo) model_simple <- brm( phen ~ cofactor + (1|gr(phylo, cov = A)), data = data_simple, family = gaussian(), data2 = list(A = A), prior = c( prior(normal(0, 10), "b"), prior(normal(0, 50), "Intercept"), prior(student_t(3, 0, 20), "sd"), prior(student_t(3, 0, 20), "sigma") ) ) Output: Error: Grouping structure 'gr' expects only a single grouping term
If you need to use math formula, use Latex syntax:
Don’t forget to attach tags (top right of this form) for application area/class of models or other general subject areas your topic touches on.