plot_prob_dtt {RPANDA} | R Documentation |
Plot diversity through time with confidence intervals.
Description
Plots confidence intervals of the estimated number of species through time using a matrix of probabilities given by the function 'prob_dtt'.
Usage
plot_prob_dtt(mat, grain =0.1, plot.prob = TRUE,
plot.mean = TRUE, int = TRUE, plot.bound=FALSE,
conf = 0.95, add = FALSE, col.mean = "red", col.bound = "blue",
lty="solid", lwd=1, lty.bound=1, add.present=T, ...)
Arguments
mat |
matrix of probabilities, with species numbers as rows and times as columns with rownames and colnames set to the values of each. |
grain |
the upper limit of a range of probabilities plotted in a gray scale (lower limit is zero). Higher probabilities are plotted in black. Default value is 0.1. |
plot.prob |
logical: set to TRUE (default value) to plot the probabilities. |
plot.mean |
logical: set to TRUE (default value) to plot a line for the mean. |
plot.bound |
logical: set to TRUE to plot the bounds of the confidence interval, int must be set to TRUE. |
int |
logical: set to TRUE (default value) to plot a confidence interval. |
conf |
confidence level. The default value is 0.95. |
add |
logical: set to TRUE to add the plot on an existing graph. |
col.mean |
color of the line for the mean. |
col.bound |
color of the confidence interval bounds |
lty |
style of the line for the mean (if added on a current plot) |
lwd |
the line width, a positive number (default to 1) |
lty.bound |
style of the line for the bound (if added on a current plot) |
add.present |
whether or not to add the present diversity value to the plot. Default is TRUE. |
... |
further arguments to be passed to plot or to plot.phylo. |
Details
The function assumes that the matrix of probabilities 'mat' has species numbers as rows and times as columns with rownames and colnames set to the values of each.
'Grain' must be between 0 and 1. If the plot is too pale 'grain' should be diminished (and inversely if the plot is too dark)
Value
Plot representing how the estimated number of species vary through time with confidence intervals. The darker is the plot, the higher is the probability.
Author(s)
O.Billaud, T.L.Parsons, D.S.Moen, H.Morlon
References
Morlon, H., Parsons, T.L. and Plotkin, J.B. (2011) Reconciling molecular phylogenies with the fossil record. Proc. Nat. Acad. Sci. 108: 16327-16332.
Billaud, O., Moen, D. S., Parsons, T. L., Morlon, H. (under review) Estimating Diversity Through Time using Molecular Phylogenies: Old and Species-Poor Frog Families are the Remnants of a Diverse Past.
See Also
Examples
data(Balaenopteridae)
tot_time<-max(node.age(Balaenopteridae)$ages)
if(test){
# Fit the pure birth model (no extinction) with exponential variation of the speciation rate
# with time
f.lamb <-function(t,y){y[1] * exp(y[2] * t)}
f.mu<-function(t,y){0}
lamb_par<-c(0.08, 0.01)
mu_par<-c()
result <- fit_bd(Balaenopteridae,tot_time,f.lamb,f.mu,lamb_par,mu_par,f=1,
expo.lamb = TRUE, fix.mu=TRUE)
# Compute the matrix of probabilities
prob <- prob_dtt(result, tot_time, 1:tot_time, N0=9, type="crown")
# Check that the sums of probabilities are equal to 1
colSums(prob)
# Plot Diversity through time
plot_prob_dtt(prob)
}