You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This simulation template generates tree with a Brownian Motion trait with a decreasing variance for each trait to look like ordinated data.
What does it do?
What function does it uses?
yes/no
comments
Uses make.bd.params
✅
using crude.bd.est
Uses make.traits
✅
Uses make.modifications
❌
Uses make.events
❌
bd.params
High speciation parameters to create a bushy tree.
## Load empirical data from the dispRity package
library(dispRity)
data(BeckLee_tree)
data(BeckLee_mat99)
## Estimating birth death parameters from an empirical tree
my_bd.params <- crude.bd.est(BeckLee_tree, method = "estimate")
traits
Generating a 97 dimensional process with decreasing variance per dimensions.
## Getting the number of dimensions
n_dimensions <- ncol(BeckLee_mat99)
## Calculating the variance per dimensions
variance_per_dimension <- apply(BeckLee_mat99, 2, var)/max(apply(BeckLee_mat99, 2, var))
## Creating the variance-covariance matrix (no covariance)
scale_matrix <- matrix(0, ncol = n_dimensions, nrow = n_dimensions)
diag(scale_matrix) <- variance_per_dimension
## Creating the 97D brownian motion trait
my_traits <- make.traits(process = BM.process, n = n_dimensions,
process.args = list(Sigma = scale_matrix))
A running example
## My favorite seed
set.seed(9)
## Some stopping rules
my_stop.rule <- list(max.time = 140)
## The simulation
my_simulation <- treats(stop.rule = my_stop.rule,
bd.params = my_bd.params,
traits = my_traits)
## The tree
plot(my_simulation)
## Show the simulated variance
simulated_variance <- apply(my_simulation$data, 2, var)/max(apply(my_simulation$data, 2, var))
plot(simulated_variance, ylab = "scaled_variance")
lines(y = variance_per_dimension, x = 1:97)
legend(x = "topright", pch = c(21, NA), lty = c(NA, 1), legend = c("simulated", "observed"))
Reference
If you use this template in a publication, please cite:
treats
R
The text was updated successfully, but these errors were encountered:
Generate a trait from ordinated empirical data
This simulation template generates tree with a Brownian Motion trait with a decreasing variance for each trait to look like ordinated data.
What does it do?
make.bd.params
crude.bd.est
make.traits
make.modifications
make.events
bd.params
High speciation parameters to create a bushy tree.
traits
Generating a 97 dimensional process with decreasing variance per dimensions.
A running example
Reference
If you use this template in a publication, please cite:
treats
R
The text was updated successfully, but these errors were encountered: