simulate.clock <-
function(tree, params = list(rate = 0.006, noise = 0.00001)){
rate <- params$rate
noise <- params$noise
data.matrix <- get.tree.data.matrix(tree)
branch.rates <- rep(rate, times = length(tree$edge.length))
branch.rates <- abs(branch.rates + rnorm(length(tree$edge.length), mean = 0, sd = noise))
data.matrix[, 5] <- branch.rates
data.matrix[, 6] <- data.matrix[, 5] * data.matrix[, 7]
tree$edge.length <- data.matrix[, 6]
res <- list(tree, data.matrix)
names(res) <- c("phylogram", "tree.data.matrix")
class(res) <- "ratesim"
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.