coalesceMCMC: Run MCMC for Coalescent Trees

coalescentMCMCR Documentation

Run MCMC for Coalescent Trees


These are the main function of the package to run a Markov chain Monte Carlo (MCMC) to generate a set of trees which is returned with their likelihoods, the coalescent likelihoods and the respective parameter(s).

The logLik method returns the average log-likelihood of the coalescent model. AIC, BIC, and anova use this average log-likelihood.


coalescentMCMC(x, ntrees = 3000, model = "constant", tree0 = NULL,
               printevery = 100, degree = 1, nknots = 0,
               knot.times = NULL, moves = 1:6)
## S3 method for class 'coalescentMCMC'
logLik(object, ...)
## S3 method for class 'coalescentMCMC'
AIC(object, ..., k = 2)
## S3 method for class 'coalescentMCMC'
BIC(object, ...)
## S3 method for class 'coalescentMCMC'
anova(object, ...)



a set of DNA sequences, typically an object of class "DNAbin" or "phyDat".


the number of trees to output.


the initial tree of the chain; by default, a UPGMA tree with a JC69 distance is generated.


the coalescent model to be used for resampling. By default, a constant-THETA is used.


an integer specifying the frequency at which to print the numbers of trees proposed and accepted; set to 0 to cancel all printings.

degree, nknots, knot.times

parameters used if model = "splines".


the tree moves used by the MCMC (see details).


options passed to other methods.


an bject of class "coalescentMCMC".


the coefficient used to calculate the AIC (see AIC).


Six tree moves are programmed and one is chosen randomly at each step of the MCMC. The steps are: (1) NeighborhoodRearrangement (Kuhner et al., 1995), (2) ScalingMove, (3) branchSwapping, (4) subtreeExchange, (5) NodeAgeMove, and (6) randomWalkThetaMu (all five from Drummond et al., 2002). In practice, it appears that in many situations moves = c(1, 3) is a good selection resulting in around 50% acceptance rate.


coalescentMCMC returns an object of class c("coalescentMCMC", "coda") with the log-likelihood and the parameters of each tree.

logLik, AIC and BIC return a numeric vector.

anova return an object of class "anova".


Emmanuel Paradis


Drummond, A. J., Nicholls, G. K., Rodrigo, A. G. and Solomon, W. (2002) Estimating mutation parameters, population history and genealogy simultaneously from temporally spaced sequence data. Genetics, 161, 1307–1320.

Hastings, W. K. (1970) Monte Carlo sampling methods using Markov chains and their applications. Biometrika, 57, 97–109.

Kuhner, M. K., Yamato, J. and Felsenstein, J. (1995) Estimating effective population size and mutation rate from sequence data using Metropolis-Hastings sampling. Genetics, 140, 1421–1430.

See Also

getMCMCtrees, dcoal, treeOperators


## Not run: 
out <- coalescentMCMC(woodmouse)
getMCMCtrees() # returns 3000 trees

## End(Not run)

coalescentMCMC documentation built on April 22, 2022, 5:05 p.m.