Calculates the rate of accumulation of phylogenetic B-diversity (CpB) over time slices
Source:R/CpB.R
CpB.Rd
This function estimates the rates of accumulation of phylogenetic B-diversity (CpB) over time for inputted assemblages.
Arguments
- tree
phylo. An ultrametric phylogenetic tree in the "phylo" format.
- n
numeric. A numeric value indicating the number of temporal slices (method = 1) or the time interval in million years (or phylogenetic diversity) among the tree slices (method = 2). Default is 1.
- mat
matrix. A presence/absence matrix containing all studied species and sites.
- adj
matrix. A square adjacency matrix containing the presence/absence information of all sites and their spatially adjacent ones.
- comp
character string. The component of the phylogenetic beta-diversity to obtain the rates of accumulation. It can be either "sorensen", "turnover", or "nestedness". Default is "sorensen".
- method
character string. The method for calculating the phylogenetic beta-diversity. It can be either obtained through a "pairwise" or "multisite" approach. Default is "multisite".
- criterion
character string. The method for cutting the tree. It can be either "my" (million years) or "PD" (accumulated phylogenetic diversity). Default is "my".
- pBO
numeric. A value indicating the numeric proportion to define the temporal origin at which the phylogenetic B-diversity (PB) started to accumulate in a given assemblage. Default is 5%.
- ncor
numeric. A value indicating the number of cores the user wants to parallelize. Default is 0.
Value
The function returns a data frame containing the assemblages' rates of cumulative phylogenetic B-diversity (CpB), their total phylogenetic B-diversity (PB), and their PB origin (pBO).
Details
Parallelization
Users are advised to check the number of available cores within their machines before running parallel programming.
References
See the tutorial on how to use this function on our website.
Author
Matheus Lima de Araujo matheusaraujolima@live.com
Examples
# Generate a random tree
tree <- ape::rcoal(20)
# Create a presence-absence matrix
mat <- matrix(sample(c(1,0), 20*10, replace = TRUE), ncol = 20, nrow = 10)
colnames(mat) <- tree$tip.label
# Create a random adjacency matrix
adj <- matrix(sample(c(1,0), 10*10, replace = TRUE), ncol = 10, nrow = 10)
# Fill the diagonals with 1
diag(adj) <- 1
# Calculate their CpB (sorensen) for 100 tree slices
CpB(tree, n = 100, mat = mat, adj = adj, comp = "sorensen", method = "multisite")
#> > The 100 number of pieces inputted equals to intervals of 0.0117346229387734 million of years.
#> CpB PB pBO
#> 1 4.432679 0.4608967 0.6758288
#> 2 4.576292 0.3682585 0.6546200
#> 3 4.729336 0.4112421 0.6334362
#> 4 3.977516 0.4162567 0.7531667
#> 5 4.905771 0.2586152 0.6106547
#> 6 8.195826 0.1945679 0.3655193
#> 7 4.974841 0.2766693 0.6021765
#> 8 5.177977 0.3465438 0.5785526
#> 9 4.791601 0.2686137 0.6252048
#> 10 3.855738 0.3963444 0.7769542