cpr_classify_signif {canaper}R Documentation

Classify statistical significance

Description

Given the results of cpr_rand_test(), classifies statistical significance of a biodiversity metric. The null hypothesis is that observed value does not lie in the extreme of the random values.

Usage

cpr_classify_signif(df, metric, one_sided = FALSE, upper = FALSE)

Arguments

df

Input data frame.

metric

Character vector of length 1; selected metric to classify significance. May choose from pd (phylogenetic diversity), rpd (relative phylogenetic diversity), pe (phylogenetic endemism), rpe (relative phylogenetic endemism) (case-sensitive).

one_sided

Logical vector of length 1; is the null hypothesis one-sided? If TRUE, values will be classified as significant if they are in either the top 5% or bottom 5%. If FALSE, values will be classified as significant if they are in the top 2.5% or bottom 2.5%, combined.

upper

Logical vector of length 1; only applies if one_sided is TRUE. If TRUE, values in the top 5% will be classified as significant. If FALSE, values in the bottom 5% will be classified as significant.

Details

For metrics like pe, you probably want to consider a one-sided hypothesis testing values in the upper extreme (i.e., we are interested in areas that have higher than expected endemism). For this, you would set ⁠one_sided = TRUE, upper = TRUE⁠. For metrics like pd, you probably want to consider a two-sided hypothesis (i.e., we are interested in areas that are either more diverse or less than diverse than expected at random). For this, set one_sided = FALSE.

Value

Object of class data.frame with column added for statistical significance of the selected metric. The new column name is the name of the metric with ⁠_signif⁠ appended. The new column is a character that may contain the following values, depending on the null hypothesis:

Examples


set.seed(12345)
data(phylocom)
rand_test <- cpr_rand_test(
  phylocom$comm, phylocom$phy,
  null_model = "curveball", metrics = "pd", n_reps = 50
)
cpr_classify_signif(rand_test, "pd")


[Package canaper version 1.0.0 Index]