Calculates the range weighted rate of accumulation of phylogenetic B-diversity (CpB_RW) over time slices
Source:R/CpB_RW.R
CpB_RW.Rd
This function estimates the range-weighted rates of accumulation of phylogenetic B-diversity (CpB_RW) 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.
- 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 range-weighted phylogenetic B-diversity (PB_RW) 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 range-weighted phylogenetic B-diversity (CpB_RW), their total range-weighted phylogenetic B-diversity (PB_RW), and their origin (pBO).
Details
Parallelization
Users are advised to check the number of available cores within their machines before running parallel programming.
References
Laffan, S. W., Rosauer, D. F., Di Virgilio, G., Miller, J. T., González-Orozco, C. E., Knerr, N., Thornhill, A. H., & Mishler, B. D. (2016). Range-weighted metrics of species and phylogenetic turnover can better resolve biogeographic transition zones. Methods in Ecology and Evolution, 7(5), 580–588. https://doi.org/10.1111/2041-210x.12513
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 range weighted for 100 tree slices
CpB_RW(tree, n = 100, mat = mat, adj = adj, method = "multisite")
#> > The 100 number of pieces inputted equals to intervals of 0.00564697464687796 million of years.
#> CpB_RW PB_RW pBO
#> 1 8.958268 0.4349110 0.3344098
#> 2 9.770025 0.5080866 0.3066248
#> 3 10.334197 0.4164614 0.2898853
#> 4 9.660119 0.5200874 0.3101134
#> 5 9.995885 0.5612029 0.2996965
#> 6 10.371196 0.4614058 0.2888512
#> 7 10.714812 0.4758689 0.2795879
#> 8 10.593510 0.5500048 0.2827894
#> 9 9.736709 0.4040865 0.3076740
#> 10 9.739280 0.5456430 0.3075928