simulate.rate: simulate.rate is the generic function to simulate rates along...

View source: R/simulate.rate.R

simulate.rateR Documentation

simulate.rate is the generic function to simulate rates along phylogenetic trees with any of the models.

Description

simulate.rate simulates the rate with any of the models implemented in NELSI

Usage

simulate.rate(tree, FUN, ...)

Arguments

tree

A phylogenetic tree of class 'phylo'. The branch lengths should be in units of time (a chronogram)

FUN

This is any of the rate simulation functions (please see the help for each for details on the models): - simulate.autocor.kishino - simulate.autocor.thorne - simulate.clock - simulate.tdep.generic - simulate.tdep.ho - simulate.uncor.exp - simulate.uncor.lnorm - simulate.uncor.gamma - simulate.white.noise

...

This should be the parameters for the rate models. To specify this use: params = list(parameter1 , parameter2). See the help files for each rate simulation function for details on the parameters.

Details

None

Value

An object of class 'ratesim'. This is a list with two items:

phylogram

The phylogenetic tree with branch lengths in units of substitutions (phylogram)

tree.data.matrix

This is a matrix with the number of substitutions, rates, and times along every branch in the tree. See get.tree.data.matrix for more details

Note

None.

Author(s)

David Duchene and Sebastian Duchene

References

See the original reference for NELSI: Pending.

See Also

- simulate.autocor.kishino - simulate.autocor.thorne - simulate.clock - simulate.tdep.generic - simulate.tdep.ho - simulate.uncor.exp - simulate.uncor.lnorm - simulate.uncor.gamma - simulate.white.noise

Examples

set.seed(1234525)

myTree <- rcoal(50)

# Simulate uncorrelated rates with default parameters:
rateTree.default <- simulate.rate(tree = myTree, FUN = simulate.uncor.lnorm)
plot(rateTree.default, col.lineages = rainbow(50))

# Simulate uncorrelated rates with custom parameters:
rateTree.custom <- simulate.rate(tree = myTree, FUN = simulate.uncor.lnorm, params = list(mean.log = -3.9, sd.log = 0.8))
plot(rateTree.custom, col.lineages = rainbow(50))


## The function is currently defined as
function (tree, FUN, ...) 
{
    ratesim.object <- FUN(tree, ...)
    return(ratesim.object)
  }

sebastianduchene/NELSI documentation built on Aug. 18, 2022, 11:45 p.m.