View source: R/CpR_sensitivity_plot.R
CpR_sensitivity_plot | R Documentation |
This function generates a plot of the sensitivity analysis calculated for a given cumulative phylogenetic rate (CpR) assessed through the CpR_sensitivity()
function.
CpR_sensitivity_plot(sst_output, rate = NULL, stc = "mean")
sst_output |
data frame. The outputted data frame from the |
rate |
character string. The desired phylogenetic index rate to display. It can be filled with "CpD", "CPE", "CpB", or "CpB_RW". |
stc |
character string. A statistical measure to summarize the phylogenetic rates and create the plot, which could be filled with "mean", "var", "median", "sd", "min", and "max". Default is "mean". |
The function returns a ggplot graph.
Matheus Lima de Araujo matheusaraujolima@live.com
Users can use the CpR_sensitivity_plot()
function for plotting sensitivity analysis outputs.
CpR sensitivity analysis: CpR_sensitivity()
.
# 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)
# Create a vector of number of slices
vec <- c(25, 50, 75, 100, 125, 150)
# Calculate the sensitivity of the CpD
Sens_out <- CpR_sensitivity(tree, vec, mat, rate = "CpD", samp = 5)
# Plot the sensitity analysis
CpR_sensitivity_plot(Sens_out, rate = "CpD", stc = "mean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.