Skip to content

Instantly share code, notes, and snippets.

@Rekyt
Created June 1, 2023 13:37
Show Gist options
  • Save Rekyt/89f6567a828cc88ed40768d3584d8a9c to your computer and use it in GitHub Desktop.
Save Rekyt/89f6567a828cc88ed40768d3584d8a9c to your computer and use it in GitHub Desktop.
Predict Extinction Risk from IUCN status based on EDGE2 quantification
#' Extinction probablity based on IUCN status
#'
#' This function returns an extinction probability based on a IUCN Red List
#' status. The extinction probability it returns is based on the EDGE2 metric as
#' defined by Gumbs et al. (2023) <doi:10.1371/journal.pbio.3001991>.
#' In particular, it returns the Global Endangerment 2 score (GE2).
#' See their Figure 1, Supplementary Info S1 for more information and the
#' underlying data with data sheet S4.
#'
#' The idea is that each IUCN status is associated with a median extinction risk
#' with the risk doubling as going from least to most endangered species.
#' The function is than completed to be continuous and curved from 0.0001 to
#' 0.9999 (never assigning a extinction risk of 1).
#' To convey uncertainty, species are randomly assigned an extinction risk
#' within each status category in a way that the median probability is the one
#' assigned to the Red List status.
#'
#' @param redlist_status `character(1)` defining the IUCN Red List status
#' it can be:
#' * `"LC"`, for Least Concern,
#' * `"NT"`, for Near Threatened,
#' * `"VU"`, for Vulnerable,
#' * `"EN"`, for Endangered,
#' * `"CR"`, for Critically Endangered,
#' * `"EW"`, for Extinct in the Wild,
#' * `"EX"`, for Extinct,
#' * `"DD"`, for Data Deficient,
#' * `"NE"` or `NA`, for Not evaluated species
extinction_risk_iucn_status = function(
redlist_status = c("LC", "NT", "VU", "EN", "CR", "EW", "EX", "DD", "NE", NA)
) {
redlist_status = match.arg(redlist_status)
switch(
redlist_status,
`NA` = runif(1, min = 0.0001, max = 0.9999),
"DD" = runif(1, min = 0.0001, max = 0.9999),
"NE" = runif(1, min = 0.0001, max = 0.9999),
"LC" = runif(1, min = 0.0001, max = 0.0909375),
"NT" = runif(1, min = 0.0909375, max = 0.181875),
"VU" = runif(1, min = 0.181875, max = 0.36375),
"EN" = runif(1, min = 0.36375, max = 0.60625),
"CR" = runif(1, min = 0.60625, max = 0.9999)
)
}
@Rekyt
Copy link
Author

Rekyt commented Jun 1, 2023

I'm not entirely sure of the bounds here, the medians seem off.
I've contacted Rikki Gumbs to know more about the function they used.
Let's see and revisit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment