Specifying a non-stationary model with time-heterogeneous parameters

A model is considered time-heterogeneous if rate matrix terms differ between edges on a tree.

In this example, we load and display our sample primate tree, highlighting the edges that will be assigned different rate matrices.

Specify a distinct rate matrix for the great apes

As illustrated above, this is done by specifying the names of two “ingroup” tips (their last common ancestor is the ancestor of all edges of interest) and an “outgroup” tip. We can define the clade by Orangutan and one of Human, Chimpanzee or Gorilla. Any tip not a member of the clade outside suffices as an outgroup.

To construct a model with this information, we create a dictionary that we assign to the time_het argument as follows.

The outcome of this setting to model is that the black edges will share one rate matrix, the red edges another. We fit the model to the data.

Examining the fitted likelihood function, the rate parameters differ between the edge sets.