R2 in brm

Hello, I am writing to inquire about r2 values that I consider “weird”. I fit two simple linear models for the same variables Y and X. The difference between these are that in the second (see the image) the phylogenetic relationships of the species in question were incorporated through its var-covar matrix (https: //cran.r-project.org/web/packages/brms/vignettes/brms_phylogenetics.html). To get an idea of the “fit” of the data, I use the bayes_r2 function, giving values that I consider strange, at least from a visual point of view, where it is seen that the phylogenetic model fits the data poorly, but its R2 is 0.97 !!, could someone help me see why?

Thank you very much in advance!


Would you be able to drop the code in here for a minimal working example? This will help with troubleshooting. Thanks!

Yep, sure. For the simple model I just used

simple_model <- brm(y ~ x, data=data)

for phylogenetic model
A <- ape::vcv.phylo(phylo)

phylogenetic_model <- brm (y ~ x + (1|gr(phylo, cov = A)), data=data, 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") ))

Then just:

bayes_r2(simple_model); bayes_r2(phylogenetic_model)

1 Like