Multivariate model with phylogenetic signal

Hi,

I previously asked about using brms with an uncertain phylogenetic signal in the response. After discussing with my supervisor, he suggested trying a multivariate model. Following the examples in this vignette and this vignette, I constructed the following model. The goal is to examine the correlation between the variances in two response variables that are not explained by phylogeny.

Here’s the initial model code, which ran fine:

bform1 <- bf(mvbind(logGS, logNicheScore) ~ (1|p|gr(phylo, cov = A))) + set_rescor(TRUE)
fit1 <- brm(bform1, data = a,
            data2 = list(A = A),
            chains=chains)
fit1 <- add_criterion(fit1, "loo")
summary(fit1)

Now, I want to add a fixed effect (PL, a binary variable) that affects only logGS and not logNicheScore. ChatGPT suggested the following syntax, which also runs fine, but I would appreciate confirmation from someone with experience in this type of analysis. Is this approach correct? Or did I miss anything?

bform2 <- bf(logGS ~ PL + (1|p|gr(phylo, cov = A))) + 
          bf(logNicheScore ~ (1|p|gr(phylo, cov = A))) + 
          set_rescor(TRUE)
fit2 <- brm(bform2, data = a,
            data2 = list(A = A),
            chains=chains)
fit2 <- add_criterion(fit2, "loo")
summary(fit2)

Thank you for your help!

Emma

Doesn’t this section of the vignette answer your question?

2 Likes

Yes, it is! I did not looked through the vignette previously. Thank you!

1 Like