Estimate Skew Normal for MCMCtree analysis
estimateSkewNormal.RdEstimate the shape, scale, and location paramaters of a skew normal distribution and output trees for MCMCtree input
Usage
estimateSkewNormal(
minAge,
maxAge,
monoGroups,
phy,
shape = 50,
scale = 1.5,
addMode = 0,
maxProb = 0.975,
minProb = 0.003,
estimateScale = TRUE,
estimateShape = FALSE,
estimateMode = FALSE,
plot = FALSE,
pdfOutput = "skewNormalPlot.pdf",
writeMCMCtree = FALSE,
MCMCtreeName = "skewNormalInput.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
- monoGroups
list with each element containing species that define a node of interest
- phy
fully resolved phylogeny in ape format
- shape
shape value for skew normal distribution (default = 50)
- scale
scale value for skew normal distribution (default = 1.5)
- addMode
addition to the minimum age to give the location of the distribution
- maxProb
probability of right tail (maximum bound default = 0.975)
- minProb
probability of left tail (maximum bound default = 0.003)
- 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 (default = FALSE)
- 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)
- 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 = 3):
#>
#> apeTree, maximumTimes, minimumTimes, monophyleticGroups
#> 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
monophyleticGroups <- list()
## 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
estimateSkewNormal(minAge=minimumTimes, maxAge=maximumTimes,
monoGroups=monophyleticGroups, phy=apeTree, plot=FALSE)
#> [1] "warning - minProb parameter value recycled"
#> [1] "warning - maxProb parameter value recycled"
#> [1] "warning - estimateScale argument recycled"
#> [1] "warning - estimateShape argument recycled"
#> [1] "warning - estimateMode argument recycled"
#> [1] "warning - shape parameter value recycled"
#> [1] "warning - addMode parameter value recycled"
#> Warning: Length of node.label does not match number of nodes.
#> $parameters
#> location scale shape
#> node_1 1.5 0.67 50
#> node_2 0.6 0.27 50
#> node_3 0.8 0.18 50
#> node_4 1.3 0.31 50
#>
#> $apePhy
#>
#> Phylogenetic tree with 7 tips and 6 internal nodes.
#>
#> Tip labels:
#> human, chimpanzee, bonobo, gorilla, orangutan, sumatran, ...
#> Node labels:
#> 'SN[1.5~0.67~50]', NA, 'SN[0.6~0.27~50]', 'SN[0.8~0.18~50]', NA, 'SN[1.3~0.31~50]'
#>
#> Rooted; no branch lengths.
#>
#> $MCMCtree
#>
#> 1 7 1
#>
#> 1 ((((human,(chimpanzee,bonobo))'SN(0.8,0.18,50)',gorilla)'SN(0.6,0.27,50)',(orangutan,sumatran)'SN(1.3,0.31,50)'),gibbon)'SN(1.5,0.67,50)';
#>
#> 1 //end of file
#>
#> $nodeLabels
#> [1] "'SN[1.5~0.67~50]'" "'SN[0.6~0.27~50]'" "'SN[0.8~0.18~50]'"
#> [4] "'SN[1.3~0.31~50]'"
#>