lizzieinvancouver / ospree

Budbreak review paper database
3 stars 0 forks source link

try OSPREE phylo data using phyr #389

Closed lizzieinvancouver closed 2 years ago

lizzieinvancouver commented 3 years ago

@MoralesCastilla (backed up by @dbuona) try to see if phyr package can help us ... I was looking at pglmm f(x) ... check out (in pmm repo) toy model too ... may be a better place to start?

lizzieinvancouver commented 3 years ago

From Tony on 23 Nov 2020:

So here are quick responses:

  1. The estimates of sigma2 are closely related to Pagel's lambda. Pagel's lambda takes the form sigma2 (lambdaV + (1-lambda)I), with V being the phylogenetic covariance matrix and I the identity. In phylogenetic mixed models, you would equivalently have s2 V + s2r * I, where s2r is the variance of the residuals. You can re-arrange this to get Pagel's lambda.

  2. For pglmm, you can specify covariances in two ways:

This is the easy way cov_ranef = list(insects = insect_phylo,plants = plant_phylo)

You can also use random.effects = list(re1,re2,re3,re4)

where re1...re4 specify the covariance terms in the order that they appear in the model formula.

You can see the relationship between these two ways of formulating the covariances using the function prep_dat_pglmm(). To take advantage of math tricks, the random.effects are generally specified in the same form as they are in pez. Or you can just use re1 = V1, re2 = V2, etc., where V1...V4 are the raw covariance matrices (although you have to make sure species in V are in the same order as in your data.frame). In general, random.effects gives you a lot of flexibility.

Sorry this is SO brief, but I have to "run" to class. Let me know if I need to do a better job explaining this.

lizzieinvancouver commented 2 years ago

We have a PMM running in Stan that we like, so closing this!