transition.matrix | R Documentation |
Utility function for generating discrete characters evolution transition matrices.
transition.matrix(type, states, rates = runif, self = TRUE, ...)
type |
the type of transition matrix, either "equal rates", "stepwise", "symmetric", or "all rates different". See details. |
states |
the number of states. |
rates |
either a fixed value for a rate to attribute to each possible transitions or a |
self |
logical, whether to allow reverting states (i.e. transition rates from state A to the same state A; |
... |
if |
The following transition rate matrices are currently implemented:
"equal rates" (or "ER") where all transitions are equal (including no transition if self = TRUE
).
"stepwise" (or "Dollo") transitions are allowed only in a step wise way (e.g. state 1 to 2 and 2 to 3 are allowed but not 1 to 3).
"symmetric" ("SYM") where transitions between states are all different but not directional (e.g. the change of state 1 to 2 is equal to 2 to 1). If self = TRUE
, the non transitions (e.g. from state 1 to 1) are equal.
"all rates different" (or "ARD") where all transitions are different. Note that if rates is a give value (rather than a function), then all rates are actually equal.
If rates
is a function that generates negative values or a negative value, the output transition matrix always returns absolute values.
Returns a squared "matrix"
.
Thomas Guillerme
make.traits
discrete.process
## A two states equal rates matrix with a rate of 1
## and no stationary rates (no probability of staying in the same state)
transition.matrix(type = "equal rates", states = 2, rates = 1, self = FALSE)
## Two different 6 states stepwise matrix with a random absolute normal rate
transition.matrix(type = "stepwise", states = 6, rates = rnorm)
transition.matrix(type = "stepwise", states = 6, rates = rnorm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.