MCMCtreePhy
mcmcTreePhy.RdWrapper function to estimate node distributions and add them to tree and output MCMCtree format phylogeny file. If parameter values are in vectors shorter than the number of nodes they are recycled.
Usage
MCMCtreePhy(
phy,
minAges,
maxAges,
monoGroups,
method = c("cauchy", "upper", "bound", "gamma", "skewNormal", "skewT", "fixed"),
offset = 0.1,
df = 1,
shape = 50,
scale = 1.5,
minProb = 1e-08,
addMode = 0,
maxProb = 0.975,
rightTail = 0.025,
alpha = 188,
beta = 100,
estimateScale = TRUE,
estimateShape = FALSE,
estimateMode = FALSE,
estimateAlpha = TRUE,
estimateBeta = FALSE,
plot = FALSE,
pdfOutput = "nodeDistributions.pdf",
writeMCMCtree = TRUE,
MCMCtreeName = "output.tre"
)Arguments
- phy
fully resolved phylogeny in ape format
- minAges
vector of minimum age bounds for nodes matching order in monoGroups
- maxAges
vector of maximum age bounds for nodes matching order in monoGroups
- monoGroups
list with each element containing species that define a node of interest
- method
vector of the type of calibration distribution for each node
- offset
offset value for distribution (default = 50)
- df
degrees of freedom for skew-t distribution (default = 1)
- shape
shape value for skew-t distribution (default = 50)
- scale
scale value for distribution (default = 1.5)
- minProb
probability of left tail (minimum bound) - default to hard minimum (minProb=0)
- addMode
addition to the minimum age to give the location of the distribution
- maxProb
probability of right tail (maximum bound. default = 0.975)
- rightTail
probability of right tail (maximum bound default = 0.025)
- alpha
alpha value for gamma distribution (default = 188)
- beta
beta value for gamma distribution (default = 2690)
- estimateScale
logical specifying whether to estimate scale with a given shape value (default = TRUE)
- estimateShape
logical specifying whether to estimate shape with a given scale value
- estimateMode
logical speciftying whether to estimate the scale that produces probabilities of each tail that corresponds roughly to the values given by minProb (lower tail) and maxProb (upper tail)
- 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 MCMCtree 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
data(apeData)
attach(apeData)
#> The following objects are masked from apeData (pos = 4):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 5):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 6):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 7):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 8):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 9):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> The following objects are masked from apeData (pos = 10):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
## 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("nodeOne"=15, "nodeTwo"=6,
"nodeThree"=8, "nodeFour"=13) / 10
maximumTimes <- c("nodeOne" = 30, "nodeTwo" = 12,
"nodeThree"=12, "nodeFour" = 20) / 10
# Cauchy, upper age, bound, and gamma applied individually to each node
MCMCtreePhy(phy=apeTree, minAge=minimumTimes, maxAge=maximumTimes,
monoGroups=monophyleticGroups, plot=FALSE,
method=c("cauchy", "upper", "bound", "gamma"), writeMCMCtree=FALSE)
#> Warning: Length of node.label does not match number of nodes.
#> Warning: Length of node.label does not match number of nodes.
#> Warning: Length of node.label does not match number of nodes.
#> Warning: Length of node.label does not match number of nodes.
#> $node_1
#> tL p c pL
#> node_1 1.5 0.1 0.085 1e-300
#>
#> $node_2
#> tU pR
#> node_1 1.2 0.025
#>
#> $node_3
#> tL tU pL pU
#> node_1 0.8 1.2 1e-300 0.025
#>
#> $node_4
#> alpha beta
#> node_1 140 100
#>