transition.matrix {treats}R Documentation

Makes a transition matrix

Description

Utility function for generating discrete characters evolution transition matrices.

Usage

transition.matrix(type, states, rates = runif, self = TRUE, ...)

Arguments

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 function to generate the rates (default is runif). See details.

self

logical, whether to allow reverting states (i.e. transition rates from state A to the same state A; TRUE; default) or not (FALSE).

...

if rates is a function, any optional arguments to be passed to it.

Details

The following transition rate matrices are currently implemented:

If rates is a function that generates negative values or a negative value, the output transition matrix always returns absolute values.

Value

Returns a squared "matrix".

Author(s)

Thomas Guillerme

See Also

make.traits discrete.process

Examples

## 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)


[Package treats version 1.0 Index]