9.4: Mk models where parameters vary across clades and/or through time
Another generalization of the Mk model we might imagine is a Mk model where rate parameters vary, either across clades or through time. There is some recent work along these lines, with two approaches that consider the possibility that rates of evolution for an Mk model vary on different branches of a phylogenetic tree (Marazzi et al. 2012; Beaulieu et al. 2013) .
We can understand how these methods work in general terms by considering a simple case where the rate of character evolution is faster in one clade than in the rest of the tree. This is the discrete-character version of the approaches for continuous characters that I discussed in Chapter 6 (O’Meara et al. 2006; Thomas et al. 2006) . The simplest way to implement a multi-rate discrete model is to directly incorporate variation across models into the pruning algorithm that is used to calculate the Mk model on a phylogenetic tree (see FitzJohn 2012 for implementation) .
One can, for example, consider a model where the overall rate of evolution varies between clades in a phylogenetic tree. To do this, we can specify the background rate of evolution using some transition matrix Q , and then assume that within our focal clade evolution can be modeled with some scalar value r , such that the new rate matrix is r Q . Given Q and r , one can calculate the likelihood for this model using the pruning algorithm, modified in such a way that the appropriate transition matrix is used along each branch in the tree; one can then maximize the likelihood of the model for all parameters (those describing Q , as well as r , which describes the relative rate of evolution in the focal clade compared to the background).
In even more general terms, we will consider the situation where we can describe the model of evolution using a set of Q matrices: Q 1 , Q 2 , …, Q n , each of which can be assigned to a particular branch in a phylogenetic tree (or be assigned to branches depending on some other character that influences the rate of the focal character; Marazzi et al. 2012) . The only limit here is that each Q matrix adds a new set of model parameters that must be estimated from the data, and it is easy to imagine this model becoming overparametized. If we imagine a model where every branch has its own Q -matrix, then we are actually describing the “no common mechanism” model (Tuffley and Steel 1997; Steel and Penny 2000) , which is statistically identical to parsimony. It should also be possible to create a method that explores all models connecting simple Mk and the no common mechanism model using the machinery of reversible-jump MCMC, although I do not think such an approach has ever been implemented (but see Huelsenbeck et al. 2004) .
One can also describe a situation where rate parameters in the Q matrix change through time. This might follow a constant pattern of increase or decrease through time, or might be related to some external driver like temperature. One can mimic models where rates change through time by changing the branch lengths of phylogenetic trees. If deep branches are lengthened relative to shallow branches, as is done by Pagel's δ , then we can fit a model where rates of evolution slow through time; conversely, lengthening shallow branches relative to deep ones creates a model where the overall rate of evolution accelerates through time (see FitzJohn 2012) .
More work could certainly be done in the area of time-varying rates of change. The most general approach is to write a set of differential equations that describe the changes in character state along single branches in the tree. Parameters in those equations can be made to vary, either through time or even in a way that is correlated with some external variable hypothesized to influence rates of change, like temperature or rainfall. Given such a model, the reverse-time approach of Maddison et al. (2007) can then be used to fit general time-varying (or even clade-varying) Mk models to data (see Uyeda et al. 2016) .