# Simulation of a ClaDS2 phylogeny
set.seed(1)
obj= sim_ClaDS( lambda_0=0.1,
mu_0=0.5,
sigma_lamb=0.7,
alpha_lamb=0.90,
condition="taxa",
taxa_stop = 20,
prune_extinct = TRUE)
tree = obj$tree
speciation_rates = obj$lamb[obj$rates]
extinction_rates = obj$mu[obj$rates]
plot_ClaDS_phylo(tree,speciation_rates)
# Simulation of a phylogeny with constant extinction rate and speciation
# rates evolving as a logbrownian
set.seed(4321)
obj= sim_ClaDS( lambda_0=0.1,
mu_0=0.2,
new_mu_law = "uniform",
new_lamb_law = "logbrownian",
sigma_lamb=0.4,
condition="taxa",
taxa_stop = 20,
prune_extinct = FALSE)
tree = obj$tree
speciation_rates = obj$lamb[obj$rates]
extinction_rates = obj$mu[obj$rates]
par(mar=c(1,1,0,0))
plot_ClaDS_phylo(tree,speciation_rates)
# Simulation of a phylogeny with constant extinction rate and at most one shift
# in speciation rates
set.seed(1221)
obj= sim_ClaDS( lambda_0=0.1,
mu_0=0.05,
new_mu_law = "uniform",
new_lamb_law = "uniform",
lamb_max = 0.5, lamb_min = 0,
theta = 0.1, nShiftMax = 1,
condition="taxa",
taxa_stop = 100,
prune_extinct = TRUE)
tree = obj$tree
speciation_rates = obj$lamb[obj$rates]
extinction_rates = obj$mu[obj$rates]
plot_ClaDS_phylo(tree,speciation_rates)
Run the code above in your browser using DataLab