Rev Language Reference


fnCovarion - The Covarion model rate matrix.

The `fnCovarion` function defines a covarion model rate matrix for character evolution. The resulting rate matrix incorporates rate heterogeneity where the characters/sites are allowed to move between rate categories with a switching rate.

Usage

fnCovarion(RateGenerator[] RateMatrices, RealPos[] RateScalars, RealPos[][] SwitchRates, Bool rescaled)

Arguments

RateMatrices : RateGenerator[] (pass by const reference)
Rate matrices for the characters per state.
RateScalars : RealPos[] (pass by const reference)
Rate multipliers per state.
SwitchRates : RealPos[][] (pass by const reference)
Rates between state.
rescaled : Bool (pass by value)
Should the matrix be normalized?
Default : TRUE

Return Type

Details

The covarion model allows for variation in evolutionary rates across sites over time, accommodating shifts in character state evolution.

Example

# define number of rate categories
num_cats = 2

# define rate scalars
rate_scalars <- [ 0, 1.0 ]

# obtain substitution model rate matrix for rescaling
for ( i in 1:num_cats ) {
  Q_sub[i] := fnJC( 4 )
}

# define switching rate
switching_rate = 0.1

for ( i in 1:num_cats ) {
  for ( j in 1:num_cats ) {
    if ( i == j ) {
      switch_rates[i][j] := 0
    } else {
      switch_rates[i][j] := switching_rate
    }
  }
}

# finally construct the covarion rate matrix
Q_Cov := fnCovarion(RateMatrices = Q_sub, RateScalars = rate_scalars, SwitchRates = switch_rates, rescaled = FALSE)

See Also