lizzieinvancouver / pmm

phylogenetic mixed models -- and we all learn together
2 stars 1 forks source link

try delta model #21

Open lizzieinvancouver opened 2 years ago

lizzieinvancouver commented 2 years ago

Suggested by JD on 12 June 2022:

You probably don’t want to get into this, but … another approach would be to use a delta transform of branch lengths (versus lambda) – the delta transform is a more direct measure of early vs late burst evolution. I think you only want to do this if it can be implemented by a simple substitution in your Stan code (if not, forget I ever mentioned it).

The lambda model multiplies all off-diagonal elements in the phylogenetic variance-covariance matrix by the value of λ.

In the delta model all elements of the phylogenetic variance-covariance matrix are raised to the power δ.

You could then optimise for delta, which would allow you a more direct interpretation of rate variation (delta of 1 == BM, delta <1 == Early Burst, >1 == Late Burst).

I asked: Is there still a sigma term that all elements are also multiplied by?

Yes, I think so, this is just the BM rate parameter, right?

.. and then I pulled together some notes in October when meeting with Mike Betancourt.

"Delta transform: The node heights of the phylogeny are raised to the power delta (Pagel 1999). Delta > 1 increases the length of external nodes and thus models a scenario where rates of evolution increase through time. Conversely, delta < 1 decreases the length of external nodes and thus models a scenario where rates of evolution decrease through time. Delta = 1 is a Brownian motion model (so the tree is returned unchanged)."

From https://wiki.duke.edu/display/AnthroTree/7.3.2+Branch+length+transformations+in+R

And issues with it being correlated with sigma^2: https://github.com/traitecoevo/modeladequacy/issues/58

See tempo of evolution in "Inferring the historical patterns of biological evolution' (Pagel 1999, Nature).

JD explained (over email during this time):

The delta (δ) transform simply raises node heights to the power delta; delta <1 trait evolution is concentrated early in the tree, delta >1 trait evolution is concentrated towards the tips.

See: https://lukejharmon.github.io/pcm/chapter6_beyondbm/

I asked, "Yes, but I can't tell what that means that I need to do to the matrix. Do you think I multiply all the off diagonal values by 1^delta? That's my best guess so far" ... and he replied:

I think you raise all elements to ^delta - see Eq. 6.3 in the Harmon book.

lizzieinvancouver commented 2 years ago

see also this OSPREE issue

lizzieinvancouver commented 1 year ago

I started on this several weeks okay in an ospree repo commit (see here) ... but I seem just to have recapitulated the issue Luke Harmon mentioned ...

Screen Shot 2022-11-15 at 11 00 45 PM
lizzieinvancouver commented 1 year ago

So, next step would be to add the tree transformation to the Stan code, though Will thought you could not pull the whole thing outside of the matrix (as I did, copying Mike B.) ... but I sort of think you can.