Created
July 23, 2016 06:38
-
-
Save nmatzke/31f917433a5773816bb1a4e9f652e7ed to your computer and use it in GitHub Desktop.
Converting between birth rate, death rate (speciation and extinction) and r (diversification rate) and epsilon (relative death rate)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example converting between | |
# birth rate, death rate (speciation and extinction) | |
# and | |
# r (diversification rate) and epsilon (relative death rate) | |
library(ape) | |
library(BioGeoBEARS) | |
# Load the Psychotria tree | |
trfn = np(paste(addslash(extdata_dir), "Psychotria_5.2.newick", sep="")) | |
tr = read.tree(trfn) | |
# Estimate the rates (this is a simple method in APE, | |
# see geiger for more sophisticated options) | |
# birthrate means: speciation rate | |
# deathrate means: extinction rate | |
# | |
# Note: the lineage extinction rate is a different thing | |
# from the "e" in DEC, which is a range of range | |
# contration | |
# | |
birthdeath_results = birthdeath(tr) | |
birthdeath_results | |
diversification_rate = birthdeath_results$para["b-d"] | |
relative_extinction_rate = birthdeath_results$para["d/b"] | |
birthrate = diversification_rate / (1-relative_extinction_rate) | |
deathrate = relative_extinction_rate * birthrate | |
birthrate | |
deathrate | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment