Learn R Programming

MCMCtreeR (version 1.1)

estimateGamma: Estimate Gamma Distribution for MCMCtree analysis

Description

Estimate the shape and rate paramaters of Gamma distribution and output trees for MCMCtree input

Usage

estimateGamma(minAge, maxAge, phy, monoGroups, alpha = 188,
  beta = 2690, offset = 0.1, estimateAlpha = TRUE,
  estimateBeta = FALSE, plot = FALSE, pdfOutput = "gammaPlot.pdf",
  writeMCMCtree = FALSE, MCMCtreeName = "gammaInput.tre")

Arguments

minAge

vector of minimum age bounds for nodes matching order in monoGroups

maxAge

vector of maximum age bounds for nodes matching order in monoGroups

phy

fully resolved phylogeny in ape format

monoGroups

list with each element containing species that define a node of interest

alpha

alpha value for gamma distribution (default = 188)

beta

beta value for gamma distribution (default = 2690)

offset

distance of mean value from minimum bound

estimateAlpha

logical specifying whether to estimate alpha with a given beta value (default = TRUE)

estimateBeta

logical specifying whether to estimate beta with a given alpha value (default = FALSE)

plot

logical specifying whether to plot to PDF

pdfOutput

pdf output file name

writeMCMCtree

logical whether to write tree in format that is compatible with MCMCTree to file

MCMCtreeName

MCMCtree.output file name

Value

list containing node estimates for each distribution

  • "parameters" estimated parameters for each node

  • "apePhy" phylogeny in APE format with node labels showing node distributions

  • "MCMCtree" phylogeny in MCMCtreeR format

  • "nodeLabels" node labels in MCMCtreeR format

If plot=TRUE plot of distributions in file 'pdfOutput' written to current working directory

If writeMCMCtree=TRUE tree in MCMCtree format in file "MCMCtreeName" written to current working directory

Examples

Run this code
# NOT RUN {
data(apeData)
attach(apeData)
## extract taxon descending from calibrated nodes 8, 10, 11, 13
## these nodes can be visualised using plot.phylo
## and nodelabels from ape
monophyleticGroups <- tipDes(apeData$apeTree, c(8,10,11,13))
minimumTimes <- c("8"=15, "10"=6,
"11"=8, "13"=13) / 10
maximumTimes <- c("8" = 30, "10" = 12,
"11"=12, "13" = 20) / 10
gamma.nodes <- estimateGamma(minAge=minimumTimes, maxAge=maximumTimes, 
monoGroups=monophyleticGroups, alpha=188, beta=2690, 
offset=0.1, phy=apeTree, plot=FALSE)
gamma.nodes
# }

Run the code above in your browser using DataLab