Skip to content

glmmTMB with two phylogenies: this is possible?

2 messages · Martina Carrete, Mollie Brooks

#
Hi all,

We are doing a paper in which we are exploring the variables that can 
explain the probability of occurrence of a particular behaviour 
(binomial model) between plants and birds (the independent variables are 
two continuous variables). Given that the literature gives an important 
weight to the phylogeny of both plants and birds and that the 
independent variables also have a phylogenetic signal, it was clear from 
the beginning that we had to include the phylogenies of both groups. 
This is only possible (to our knowledge) with MCMCglmm and we have done 
so. Bayesian statistics, frankly, escapes us a lot. The priors and such 
things are black boxes that we can't quite understand and, in addition, 
we are missing things that we are used to when assessing the results of 
a model: the explained variance (R2 or deviance), the posterior fit, the 
possibility of seeing if the models are inflated to 0, etc. The glmmTMBs 
are therefore a fantastic tool that we use all the time. However, in 
this case, we tried to do them including two phylogenies and there was 
no way. We don't know if it's something that hasn't been implemented or 
if we didn't know how to do it. We've looked in forums and we haven't 
been able to find anything either.

Below is the script we used, but considering only one phylogeny.

phyloZplant <- phylo.to.Z(pruned.tree.P)
q3_fylo_P <- datG %>% mutate(sp_plant = factor(sp_plant, levels = 
phyloZplant at Dimnames[[1]]))

phyloZbird <- phylo.to.Z(pruned.treeB)
q3_fylo_B <- datG %>% mutate(sp_bird = factor(sp_bird, levels = 
phyloZbird at Dimnames[[1]]))

glmmTMB_fit_gauss1 <- phylo_glmmTMB(binomial_variable~ continuous1 + 
continuous2 + (1|sp_bird)
                                     , data=q3_fylo_B
                                     , phyloZ = phyloZbird
                                     , phylonm = "sp_bird"
                                     , doFit = TRUE
                                     , REML = FALSE
                                     , ziformula=~0,
                                     , family = "binomial"
)

We are interested in a model where we can include the phylogeny of birds 
but also the phylogeny of plants.

Any suggestions would be very welcome,
Thank you very much!

Un abrazo

Martina
#
Hi Martina,

Maeve McGuillycuddy is on vacation right now, but I was just talking to her about this last week. She implemented this capability for glmmTMB (here https://github.com/mmcgillycuddy/glmmTMB) and has a paper accepted for publication in Journal of Statistical Software. We plan to make it available in the main GitHub branch of glmmTMB as soon as possible when Maeve is back to work. One of us will follow up here as soon as possible. If you want to start now, install the branch at the link above and then look at vignette("covstruct") or see this test for a demonstration for how it?s intended to be used

https://github.com/glmmTMB/glmmTMB/commit/b785819c2a03bf7364e53210d092cfc89d4ceced

cheers,
Mollie