overview

This package is an R implementation (of dependent discrete models) derived from ‘BayesTraits’ V5.0.3 (https://github.com/AndrewPMeade/BayesTraits-Release/tree/Release).

major differences from BayesTraits, limitations, and other things to note

treeset<-list()
treeset[[1]]<-ttree

examples

#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$anc

citation

If you use this package in your research, please cite:

license

GPL-3