The function fitMk fits a so-called extended Mk model for discrete character evolution (Lewis, 2001).
plot.fitMk plots an object of class "fitMk" returned by fitMk. plot.gfit plots an object of class "gfit" from geiger's fitDiscrete function. Both plots portray the fitted model using a graph of arrows connecting states.
The function fitmultiMk fits an Mk model in which the transition rates between character states are allowed to vary depending on the mapped state of a discrete character on the tree. It can be combined with, for example, paintSubTree to test hypotheses about how the process of discrete character evolution for x varies between different parts of the tree.
The function fitpolyMk fits an Mk model to data for a discrete character with intraspecific polymorphism. Polymorphic species should be coded with the name of the two or more states recorded for the species separated by a space (e.g., A+B would indicate that both states A and B are found in the corresponding taxon). Invariably it's assumed that transitions between states must occur through a polymorphic condition, whereas transitions cannot occur directly between two incompatible polymorphic conditions. For instance, a transition between A+B and B+C would have to occur through the monomorphic state B. At time of writing, this function permits the models "ER" (equal rates for all permitted transitions), "SYM" (symmetric backward & forward rates for all permitted transitions), "ARD" (all-rates-different for permitted transitions), and a new model called "transient" in which the acquisition of polymorphism (e.g., A -> A+B) is assumed to occur at a different rate than its loss (e.g., A+B -> B). The method plot.fitpolyMk plots the fitted Mk model with intraspecific polymorphism.
The function mcmcMk runs a Bayesian MCMC version of fitMk. The shape of the prior distribution of the transition rates is \(\Gamma\), with \(\alpha\) and \(\beta\) via the argument prior, which takes the form of a list. The default value of \(\alpha\) is 0.1, and \(\beta\) defaults to a value such tha \(\alpha/\beta\) is equal to the parsimony score for x divided by the sum of the edge lengths of the tree. The shape of the proposal distribution is normal, with mean zero and a variance that can be controlled by the user via the optional argument prior.var. The argument auto.tune, if TRUE or FALSE, indicates whether or not to 'tune' the proposal variance up or down to target a particular acceptance rate (defaults to 0.5). auto.tune can also be a numeric value between 0 and 1, in which case this value will be the target acceptance ratio. The argument plot indicates whether the progress of the MCMC should be plotted (defaults to TRUE, but runs much faster when set to FALSE).
The method plot.mcmcMk plots a log-likelihood trace and a trace of the rate parameters from the MCMC. (This the samem graph that is created by setting plot=TRUE in mcmcMk.) The method density.mcmcMk computes a posterior density on the transition rates in the model from the posterior sample obtained in the MCMC, will import the package coda if it is available, and returns an object of class "density.mcmcMk". Finally, the method plot.density.mcmcMk creates a plot of the posterior density (or a set of plots) for the transition rates between states.
Finally, the function fitHRM fits a hidden-rate Mk model following Beaulieu et al. (2013). For the hidden-rate model we need to specify a number of rate categories for each level of the trait - and this can be a vector of different values for each trait. We can also choose a model ("ER", "SYM", or "ARD"), as well as whether or not to treat the character as a 'threshold' trait (umbral=TRUE, defaults to FALSE). This latter model is basically one that allows absorbing conditions for some hidden states. This is a work in progress.