R: Compute prior odds of a rate shift on each branch of a...
getBranchShiftPriors
R Documentation
Compute prior odds of a rate shift on each branch of a phylogeny
from BAMM output
Description
Computes the prior probability of a rate shift event for each
branch. These results are important for identifying topological rate
shift locations on phylogenies with marginal probabilities that exceed
those predicted under the prior alone.
Usage
getBranchShiftPriors(phy, expectedNumberOfShifts)
Arguments
phy
An object of class phylo.
expectedNumberOfShifts
The expected number of shifts under the
prior.
Details
This function computes the prior odds on the distribution of
numbers of rate shift events per branch under the prior. It returns an
object which is nothing more than a copy of the original phylogenetic
tree but where each branch length has been replaced by the prior
probability of a rate shift on each branch.
The significance of this function is that it lets us explicitly
determine which branches have shift probabilities that are elevated
relative to the prior expectation.
Value
A class phylo with all the components of the original class
phylo object, with the following changes:
edge.length
Branch lengths now represent the prior probability
of a rate shift on each branch.
data(whales)
prior_tree1 <- getBranchShiftPriors(whales, expectedNumberOfShifts = 1)
prior_tree10 <- getBranchShiftPriors(whales, expectedNumberOfShifts = 10)
# plot prior expectations for branches based on these two counts:
plot(prior_tree1$edge.length ~ prior_tree10$edge.length, xlim=c(0,0.05),
ylim=c(0,0.05), asp=1)
lines(x=c(0,1), y=c(0,1))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/getBranchShiftPriors.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getBranchShiftPriors
> ### Title: Compute prior odds of a rate shift on each branch of a phylogeny
> ### from BAMM output
> ### Aliases: getBranchShiftPriors
> ### Keywords: models
>
> ### ** Examples
>
> data(whales)
> prior_tree1 <- getBranchShiftPriors(whales, expectedNumberOfShifts = 1)
> prior_tree10 <- getBranchShiftPriors(whales, expectedNumberOfShifts = 10)
> # plot prior expectations for branches based on these two counts:
> plot(prior_tree1$edge.length ~ prior_tree10$edge.length, xlim=c(0,0.05),
+ ylim=c(0,0.05), asp=1)
> lines(x=c(0,1), y=c(0,1))
>
>
>
>
>
> dev.off()
null device
1
>