This package is an R implementation (of dependent discrete models) derived from ‘BayesTraits’ V5.0.3 (https://github.com/AndrewPMeade/BayesTraits-Release/tree/Release).
treeset<-list()
treeset[[1]]<-ttree#load test data
libarary(rphylo)
data(ttree)
data(tdata)
data(ttree2)
data(tdata2)
xx<-list()
xx[[1]]<-ttree#m1: model with
# - exponential prior, whose mean is drawn from (hyper prior) uniform (0,10).
# - MCMC is used but without reversible jump.
# - State frequencies are set equal.
m1<-run_dep_model(xx,
charfile = tdata,
burnin = 1000,
iterations = 10000,
sample_freq = 1000,
prior = list(type = "exponential"),
hp =list(mean = c(0, 10)),
revjump = F,
recon_nodes = NULL,
tags = NULL,
pis = c(1,1,1,1),
seed = 42
)
m1$rates #m2: model with
# - exponential prior, whose mean is 10.
# - RJMCMC,
# - State frequencies are set as following empirical distribution.
m2<-run_dep_model(ttree2,
charfile = tdata2,
burnin = 1000,
iterations = 100000,
sample_freq = 1000,
prior = list(type = "exponential", mean=10),
hp = NULL,
revjump = TRUE,
recon_nodes = c("root_node"),
tags =list(root_node = ttree2[[1]]$tip.label),
pis = get_emp_freq(tdata),
seed = 42
)
m2$rates
#get posterior probs for reconstructed node
m2$ancIf you use this package in your research, please cite:
Pagel, M., A. Meade and D. Barker (2004). “Bayesian estimation of ancestral character states on phylogenies.” Systematic biology 53(5): 673-684.
Pagel, M. (1994). “Detecting correlated evolution on phylogenies: a general method for the comparative analysis of discrete characters.” Proceedings of the Royal Society of London. Series B: Biological Sciences 255(1342): 37-45.
Pagel, M. and A. Meade (2006). “Bayesian analysis of correlated evolution of discrete characters by reversible-jump Markov chain Monte Carlo.” The American Naturalist 167(6): 808-825.
GPL-3