Skip to contents

This function allows the evaluation of the sensitivity of the estimated rates of accumulation of a given phylogenetic index (e.g., CpD(), CpE(), CpB(), CpB_RW()) to the number of slices inputted by the user.

Usage

CpR_sensitivity(tree, vec, mat, adj, rate, samp, comp, method, criterion, ncor)

Arguments

tree

phylo. An ultrametric phylogenetic tree in the "phylo" format.

vec

numeric vector. A numeric vector containing a series of numbers of slices.

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.

rate

character string. The desired cumulative phylogenetic rate to be assessed, which can be the phylogenetic diversity (CpD), phylogenetic endemism (CpE), phylogenetic B-diversity (CpB), or phylogenetic B-diversity range-weighted (CpB_RW). Default is NULL, but must be filled with "CpD", "CPE", "CpB_RW", or "CpB".

samp

numeric. The number of assemblages, or sites, to be sampled to make the sensitivity analysis.

comp

character string. The component of beta-diversity that the user wants to calculate the CpB. It can be either "sorensen", turnover" or "nestedness". This argument works only when "rate = CpB". Default is "sorensen".

method

character string. The method for calculating the CpB-rate. It can be either "pairwise" or "multisite". This argument works only when the argument "rate" is set to run for "CpB" or "CpB_RW". 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".

ncor

numeric. A value indicating the number of cores the user wants to parallelize. Default is 0.

Value

This function returns a data frame containing the sensitivity analysis for a given rate of accumulation of a phylogenetic index. This outputted data frame contains, for each row or assemblage, a column with the rate value assessed for each inputted number of slices.

Details

Parallelization

Users are advised to check the number of available cores within their machines before running parallel programming.

Plotting

For plotting the sensitivity analysis output users can use CpR_sensitivity_plot().

References

See the tutorial on how to use this function on our website.

See also

Other cumulative phylogenetic index rate analysis: CpD(), CpE(), CpB(), CpB_RW()

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

# Calculate the CpD for 100 tree slices
CpD(tree, n = 100, mat = mat)
#> > The 100 number of pieces inputted equals to intervals of 0.0224314086969455 million of years.
#>          CpD       PD      pDO
#> 1  0.8637980 7.395886 3.468093
#> 2  0.8825646 7.557231 3.394349
#> 3  0.8851682 7.578538 3.384365
#> 4  0.8869090 7.591469 3.377722
#> 5  0.8401733 6.891534 3.565612
#> 6  0.8355007 6.857295 3.585553
#> 7  0.8998335 7.695561 3.329207
#> 8  0.8954977 7.661323 3.345326
#> 9  0.8954977 7.661323 3.345326
#> 10 0.7899798 6.510382 3.792163

# Create a vector of number of slices
vec <- c(25, 50, 75, 100, 125, 150)

# Calculate the sensitivity of the CpD
CpR_sensitivity(tree, vec, mat, rate = "CpD", samp = 5)
#> > The 25 number of pieces inputted equals to intervals of 0.0897256347877822 million of years.
#> > The 50 number of pieces inputted equals to intervals of 0.0448628173938911 million of years.
#> > The 75 number of pieces inputted equals to intervals of 0.0299085449292607 million of years.
#> > The 100 number of pieces inputted equals to intervals of 0.0224314086969455 million of years.
#> > The 125 number of pieces inputted equals to intervals of 0.0179451269575564 million of years.
#> > The 150 number of pieces inputted equals to intervals of 0.0149542724646304 million of years.
#>          25        50        75       100       125       150
#> 1 0.7997823 0.8418158 0.8564061 0.8637980 0.8682838 0.8712758
#> 2 0.7791575 0.8192951 0.8331586 0.8401733 0.8444371 0.8472702
#> 3 0.8328038 0.8768312 0.8921018 0.8998335 0.9045301 0.9076592
#> 4 0.8168800 0.8600116 0.8749781 0.8825646 0.8871692 0.8902388
#> 5 0.8209008 0.8642593 0.8792884 0.8869090 0.8915329 0.8946157