correlated.trees: Simulate correlated branch lengths among loci on a phylogeny...

View source: R/simclock.R

correlated.treesR Documentation

Simulate correlated branch lengths among loci on a phylogeny under a relaxed clock

Description

Simulate correlated branch lengths among loci on a phylogeny under a relaxed clock

Usage

correlated.trees(tree, model, r, s2, nloci, corr)

Arguments

tree

an object of class phylo representing a bifurcating phylogeny

model

character, the relaxed clock model

r

numeric, the mean rate in substitutions per site

s2

numeric, the rate "diffusion" parameter for the relaxed clocks

nloci

numeric, the number of trees to simulate (one per locus)

corr

numeric, the correlation of log rates among loci

Details

A total of nloci trees are simulated, with the log-rates for branches across trees having correlation corr.

Value

A list with two elements: A list of length nloci of trees of class phylo with branch lengths in substitutions per site, and a matrix of branch rates for each locus.

Author(s)

Mario dos Reis

See Also

relaxed.tree to simulate a single tree.

Examples

require(ape)
par(mfrow=c(2,3))

data(pri10s)
# ILN model:
# Simulate using autocorrelated log-normal rates on a primate phylogeny,
# with no correlation among three loci:
iln0 <- correlated.trees(pri10s, model="iln", r=.04e-2, s2=.1, 3, 0)
lapply(iln0$trees, plot)
# Repeat with strong correlation among loci:
ilnc <- correlated.trees(pri10s, model="iln", r=.04e-2, s2=.1, 3, 0.9)
lapply(ilnc$trees, plot)

# GBM model:
# Simulate using autocorrelated log-normal rates on a primate phylogeny,
# with no correlation among three loci:
gbm0 <- correlated.trees(pri10s, model="gbm", r=.04e-2, s2=.26e-2, 3, 0)
lapply(gbm0$trees, plot)
# Repeat with strong correlation among loci:
gbmc <- correlated.trees(pri10s, model="gbm", r=.04e-2, s2=.26e-2, 3, 0.9)
lapply(gbmc$trees, plot)




dosreislab/simclock documentation built on June 9, 2025, 11:57 p.m.