Phylogenetic varying slopes and intercepts model

I’m trying to fit a phylogenetic model to model the relationship between x and y. (eg. y~x +(1|species). However, species are grouped into major categories (families, orders, etc). What is the correct way to account for this hierarchical structure, while estimating slopes and random intercepts for one of those categories? For example, if I want the estimates of slopes and intercepts for each level of the family category:
is
a) y~x+(1|species)+(1+x|family),
b) y~x+(1+x|species/family), or I have to add the family category as a fixed effect
c) y~x+family(1+family|species)

Thank you very much in advance

Please also provide the following information in addition to your question:

  • Operating System: Ubuntu 18.04
  • brms Version:2.9.0

Welcome to discourse and sorry for my late reply.

If you just want x to have a varying effect across family but not over species (which seems to be what you want), I would go for option (a).

2 Likes

Sorry for delay!, Thank you very much for you help!