knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
An overview of the methods available for assessing biological metric sensitivity to a binary disturbance gradient (e.g., Reference vs. Test or Least Impacted vs. Most Impacted) within the mmir package is provided.
Metric sensitivity is the measure of a metric’s responsiveness to environmental
degradation (Barbour et al. 1999). There are three methods for evaluating metric sensitivity in the mmir package: 1) the Barbour et al. (1996) method, 2) Discrimination Efficiency (DE), and 3) Balanced Discrimination Efficiency (BDE). All three methods will be applied with the use of the sensitivity()
function.
Barbour et al. (1996) created a visual method for evaluating metric response to a defined disturbance gradient.
DE is a measure of the percentage of degraded samples correctly identified below the reference distributions 25th percentile for metrics that decrease with degradation or the percentage of degraded samples correctly identified above the reference distributions 75th percentile for metrics that increase with disturbance.
WARNING: This function is experimental and has not been published in the literature.
BDE attempts to update the DE method by throwing more computation power at the problem. BDE tests multiple thresholds for separating the reference and degraded distributions in an attempt to find the separation point that results in approximate equivalence of sensitivity and specificity.
Load the appropriate packages into the R environment.
library(tidyr) library(dplyr) library(mmir)
Load the data created and exported from the Metric Calculation vignette.
data("nrsa_nap_metrics.df")
The metric data is in a wide-format, where each row represents a unique sample and the columns represent unique metrics. To evaluate the sensitivity of these metrics, the data needs to first be transformed to a long-format, where each row represents a unique metric and metric value associated with a unique sample; the column names in the wide-format will become row values in the long-format and the values in the wide-format will be condensed to a single column in the long-format. The tidyr pivot_longer()
functions simplifies the conversion form a wide- to a long-format. The cols
argument enables the user to select or ignore columns that will be manipulated. In the example below, the uid (i.e., the unique sample identifier) and rr_nrsa_cat (i.e., the disturbance gradient category) are ignored during the conversion from a wide- to long-format. This means that these columns will still appear in the long-format but they will not be collapsed into the name and value columns.
long.df <- tidyr::pivot_longer(data = nrsa_nap_metrics.df, cols = -c(uid, rt_nrsa_cat), names_to = "metric", values_to = "value")
The sensitivity()
function will provide:
metric
: The name of the metric.disturbance
: Indicates if metric increases ("increase"), decreases ("decrease"), or remains the same ("equal") with disturbance. This is determined by comparing the medians of the specified for the .reference
and .degraded
arguments.barbour
: The Barbour et al. (1996) score.de_thresh
: The 25th or 75th percentile of the reference distribution used as the threshold to determine the DE value.de
: The DE value.bde_thresh
: The threshold determined to equally identify the .reference
and .degraded
distributions.bde
: The BDE value.sensitivity.df <- sensitivity(.dataframe = long.df, .metric_col = metric, .value_col = value, .condition_col = rt_nrsa_cat, .reference = "least disturbed", .degraded = "most disturbed")
sensitivity.df %>% knitr::kable()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.