Description Usage Arguments Value
View source: R/model_estimation.R
Estimates rates of discrete trait evolution under a Markov model with a single transition matrix fitted to the tree. Implements a lineage-age model which influences how fast trait evolution happens given the age of each lineage. Lineage-age is controlled by a budding probability factor. Budding speciation, as applied here, means that one of the descendant lineages from an internal node will be a continuation of the ancestral lineage. The other descendant will be a new lineage.
1 2 3 4 5 6 7 8 9 10 11 12 13 | mcmc_mk_budd_exp(
phy,
trait,
k,
prior_beta_Q = c(2, 5),
prior_beta_budd = c(2, 5),
prior_exp_rate = 1,
sample_prob = c(0.25, 0.25, 0.25, 0.25),
Q_prop = 0.2,
budd_prop = 0.2,
rate_prop = 0.2,
gen = 100
)
|
phy |
phylogeny with branch lengths proportional to time |
trait |
named vector with discrete traits |
k |
a character vector with the names of the states. Need to match the states in 'traits' |
prior_beta_Q |
a numeric vector with two elements informing the alpha and beta shape parameters for a Beta distribution used as a prior to the rates of transition. Here we scale the Beta distribution such that the maximum rate will be equal to 10x the transition rate estimated for a all equal rates model, and used as the starting point for the MCMC estimation. |
prior_beta_budd |
a numeric vector with two elements informing the alpha and beta shape parameters for a Beta distribution used as a prior to the probability of budding speciation applied at each node of the phylogeny. |
prior_exp_rate |
the mean of the exponential distribution used as a prior for the exponential decay rate applied to the model. |
sample_prob |
a numeric vector with the proposal ratio for each of the four free parameters of the model. In order: transition rates, budding probabilities, exponential rate function, lineage history. |
Q_prop |
proposal rate for a multiplier rate proposal |
budd_prop |
proposal rate for a multiplier rate proposal |
rate_prop |
proposal rate for a multiplier rate proposal |
gen |
total number of generations, including burn-in, used in the MCMC estimation |
a list with the acceptance rate (accept), the likelihood (lik), the prior probabilities (prior), the transition rates (Q), the probability of budding speciation(budd), and the posterior distribution of the rate scalers (exp_rate).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.