Hi all,
I’ve been fiddling with phylogenetic mixed models from evolutionary biology recently. In these models, you have a “random” effect featuring a VCV (derived from an estimated phylogeny) that’s known up to a constant. They’re mechanically identical to animal models (of which Diogo Melo has a Stan example here: https://github.com/diogro/stanAnimal/blob/master/animalModelUni.stan) Because the phylogeny itself is an upstream estimand and phylogenies are commonly estimated using Bayesian methods (i.e. BEAST, MrBayes), you end up with a posterior distribution of phylogenetic trees that capture the uncertainty in your phylogenetic estimate. Therefore, you implicitly have a posterior distribution of VCVs, and it would be nice to include that uncertainty in downstream analyses.
You can do that in BUGS (described here: https://bmcevolbiol.biomedcentral.com/articles/10.1186/1471-2148-12-102 with code in the appendix), but I was wondering whether there was an equivalent way to average over this phylogenetic uncertainty in Stan. I’ve skimmed through the manual, but I couldn’t spot anything. Clearly an array of matrices is possible, but I couldn’t work out a way of sampling over them.