################################################################################ # # RevBayes Example: Bayesian inference of rates of evolution under a # constant-rate Brownian-motion model # # # authors: Michael R. May and Sebastian Höhna # ################################################################################ ####################### # Reading in the Data # ####################### ### Select the trait to analyze # Datasets: Female Mass, Tail Length – Body Length Residuals, Body Length – Mass Residuals, Maximum Age, Sexual Dimorphism, Geographic Range Size, Latitudinal Midpoint, Distance to Continental Centroid, Population Density, Home Range Size, Group Size, Gestation Duration, Litter size trait <- 1 ### Read in the trees T <- readTrees("data/primates_tree.nex")[1] ### Read in the character data data <- readContinuousCharacterData("data/primates_cont_traits.nex") data.excludeAll() data.includeCharacter( trait ) # Create some vector for the moves and monitors of this analysis moves = VectorMoves() monitors = VectorMonitors() ########################## # Specify the tree model # ########################## tree <- T ########################## # Specify the rate model # ########################## sigma2 ~ dnLoguniform(1e-5, 1e-1) moves.append( mvScale(sigma2, weight=1.0) ) ########################## # Specify the BM process # ########################## X ~ dnPhyloBrownianREML(tree, branchRates=sqrt(sigma2) ) X.clamp(data) ############# # The Model # ############# mymodel = model(sigma2) ### set up the monitors that will output parameter values to file and screen monitors.append( mnModel(filename="output/simple_BM.log", printgen=10) ) monitors.append( mnScreen(printgen=1000, sigma2) ) ################ # The Analysis # ################ ### workspace mcmc ### mymcmc = mcmc(mymodel, monitors, moves, nruns=2, combine="mixed") ### run the MCMC ### mymcmc.burnin(generations=5000, tuningInterval=100) mymcmc.run(generations=50000, tuningInterval=100) ## quit ## q()