`marginalShiftProbsTree`

computes a version of a
phylogenetic tree where each branch length is equal to the marginal
probability that a shift occurred on a particular branch. The
`cumulativeShiftProbsTree`

includes the cumulative probability
that a shift occurred on a given branch. See details.

1 2 3 | ```
cumulativeShiftProbsTree(ephy)
marginalShiftProbsTree(ephy)
``` |

`ephy` |
An object of class |

The *marginal shift probability tree* is a copy of the
target phylogeny, but where each branch length is equal to the
branch-specific marginal probability that a rate-shift occurred on the
focal branch. For example, a branch length of 0.333 implies that 1/3
of all samples from the posterior had a rate shift on the focal branch.

**Note:** It is highly inaccurate to use marginal shift
probabilities as a measure of whether diversification rate
heterogeneity occurs within a given dataset. Consider the following
example. Suppose you have a tree with topology (A, (B, C)). You find a
marginal shift probability of 0.5 on the branch leading to clade C,
and also a marginal shift probability of 0.5 on the branch leading to
clade BC. Even though the marginal shift probabilities appear low, it
may be the case that the joint probability of a shift occurring on
*either* the branch leading to C or BC is 1.0. Hence, you could
be extremely confident (posterior probabilities approaching 1.0) in
rate heterogeneity, yet find that no single branch has a particularly
high marginal shift probability. In fact, this is exactly what we
expect in most real datasets, because there is rarely enough signal to
strongly support the occurrence of a shift on any particular branch.

The *cumulative shift probability tree* is a copy of the target
phylogeny but where branch lengths are equal to the cumulative
probability that a rate shift occurred somewhere on the path between
the root and the focal branch. A branch length equal to 0.0 implies
that the branch in question has evolutionary rate dynamics that are
shared with the evolutionary process starting at the root of the tree.
A branch length of 1.0 implies that, with posterior probability 1.0,
the rate dynamics on a branch are decoupled from the "root process".

An object of class `phylo`

, but with branch lengths equal to
the marginal or cumulative shift probabilities.

Dan Rabosky

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
data(whales)
data(events.whales)
ed <- getEventData(whales, events.whales, nsamples = 500)
# computing the marginal shift probs tree:
mst <- marginalShiftProbsTree(ed)
# The cumulative shift probs tree:
cst <- cumulativeShiftProbsTree(ed)
#compare the two types of shift trees side-by-side:
plot.new()
par(mfrow=c(1,2))
plot.phylo(mst, no.margin=TRUE, show.tip.label=FALSE)
plot.phylo(cst, no.margin=TRUE, show.tip.label=FALSE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.