Package 'red'

Title: IUCN Redlisting Tools
Description: Includes algorithms to facilitate the assessment of extinction risk of species according to the IUCN (International Union for Conservation of Nature, see <https://www.iucn.org/> for more information) red list criteria.
Authors: Pedro Cardoso [aut] , Vasco V. Branco [cre, aut]
Maintainer: Vasco V. Branco <[email protected]>
License: GPL-3
Version: 1.6.1
Built: 2024-11-14 05:46:35 UTC
Source: https://github.com/vascobranco/red

Help Index


Area of Occupancy (AOO).

Description

Calculates the Area of Occupancy of a species based on either known records or predicted distribution.

Usage

aoo(spData)

Arguments

spData

One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (either 0/1 or probabilistic values).

Details

AOO is calculated as the area of all known or predicted cells for the species. The resolution will be 2x2km as required by IUCN.

Value

A single value in km2 or a vector with lower confidence limit, consensus and upper confidence limit (probabilities 0.975, 0.5 and 0.025 respectively).

Examples

range = red.examples("red.range")
aoo(range)

Countries of occurrence.

Description

Extracts the names or ISO codes of countries of occurrence of a species based on either records or predicted distribution.

Usage

countries(spData, zone = NULL, ISO = FALSE)

Arguments

spData

One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values).

zone

UTM zone if data is in metric units.

ISO

Outputs either country names (FALSE) or ISO codes (TRUE).

Details

Country boundaries and designations are based on data(worldborders) from package maptools.

Value

A vector with country names or codes.

Examples

records = red.examples("red.records")
range = red.examples("red.range")
countries(records)
countries(range, ISO = TRUE)

Elevation limits.

Description

Calculates the elevation (or depth) limits (range) of a species based on either known records or predicted distribution.

Usage

elevation(spData, dem = NULL)

Arguments

spData

One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values).

dem

RasterLayer object. Should be a digital elevation model (DEM) of the relevant area. If not given the function will try to read it from base data, only works with longlat data.

Details

Maximum and minimum elevation are calculated based on the DEM.

Value

A vector with two values (min and max) in meters above (or below) sea level.

Examples

records = red.examples("red.records")
range = red.examples("red.range")
layers = red.examples("red.layers")
dem = layers[[3]]
elevation(records, dem)
elevation(range, dem)

Extent of Occurrence (EOO).

Description

Calculates the Extent of Occurrence of a species based on either records or predicted distribution.

Usage

eoo(spData)

Arguments

spData

spData One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (either 0/1 or probabilistic values).

Details

EOO is calculated as the minimum convex polygon covering all known or predicted sites for the species.

Value

A single value in km2 or a vector with lower confidence limit, consensus and upper confidence limit (probabilities 0.975, 0.5 and 0.025 respectively).

Examples

records = red.examples("red.records")
range = red.examples("red.range")
eoo(records)
eoo(range)

Output kml files.

Description

Creates kml files for Google Maps as required by IUCN guidelines.

Usage

kml(spData, zone = NULL, filename, mapoption = "aoo", smooth = 0, rad = 0.1)

Arguments

spData

One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values).

zone

UTM zone if data is in metric units.

filename

The name of file to save, should end with .kml.

mapoption

Type of representation, any of "points", "eoo" or "aoo".

smooth

Smooths the kml lines as per IUCN guidelines. Higher values represent smoother polygons.

rad

radius of circles in degrees if mapoption is "points". It can be the same value for all points or a vector with length equal to number of records in spData representing associated error. The default is about 10km (0.1 degrees) as per IUCN guidelines.

Value

A kml with polygon or circles around records.


Map creation.

Description

Creates maps ready to print in pdf or other formats.

Usage

map.draw(
  longlat = NULL,
  layer,
  spName,
  borders = FALSE,
  scale = TRUE,
  legend = FALSE,
  sites = TRUE,
  mcp = FALSE,
  print = FALSE
)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record.

layer

RasterLayer object representing the presence/absence map for the species.

spName

String of species name.

borders

If TRUE country borders are drawn.

scale

If TRUE a distance scale in km is drawn.

legend

If TRUE the legend for the map is drawn.

sites

If TRUE the record locations are drawn.

mcp

If TRUE the minimum convex polygon representing the Extent of Occurrence is drawn.

print

If TRUE a pdf is saved instead of the output to the console.

Examples

records = red.examples("red.records")
range = red.examples("red.range")
par(mfrow = c(1,2))
map.draw(records, layer = range, mcp = TRUE)

Species distributions made easy (multiple species).

Description

Single step for prediction of multiple species distributions. Output of maps (in pdf format), klms (for Google Earth) and relevant data (in csv format).

Usage

map.easy(
  longlat,
  layers = NULL,
  habitat = NULL,
  zone = NULL,
  thin = TRUE,
  error = NULL,
  move = TRUE,
  dem = NULL,
  pca = 0,
  filename = NULL,
  mapoption = NULL,
  testpercentage = 0,
  mintest = 20,
  points = FALSE,
  runs = 0,
  subset = 0
)

Arguments

longlat

data.frame of taxon names, longitude and latitude or eastness and northness (three columns in this order) of each occurrence record.

layers

If NULL analyses are done with environmental layers read from data files of red.setup(). If a Raster* object as defined by package raster, analyses use these.

habitat

Raster* object as defined by package raster. Habitat extent layer (0/1) used instead of layers if any species is an habitat specialist.

zone

UTM zone if data is in metric units. Used only for correct placement of kmls and countries.

thin

boolean defining if species data should be thinned before modeling (only for SDMs).

error

Vector of spatial error in longlat (one element per row of longlat) in the same unit as longlat. Used to move any point randomly within the error radius.

move

If TRUE, identifies and moves presence records to closest cells with environmental data. Use when spatial error might put records outside such data.

dem

RasterLayer object. It should be a digital elevation model for calculation of elevation limits of the species. If NULL, dem from red.setup() is used if possible, otherwise it will be 0.

pca

Number of pca axes for environmental data reduction. If 0 (default) no pca is made.

filename

Name of output csv file with all results. If NULL it is named "Results_All.csv".

mapoption

Vector of values within options: points, habitat and sdm; each value corresponding to the function to be used for each species (map.points, map.habitat, map.sdm). If a single value, all species will be modelled according to it. If NULL, the function will perform analyses using map.points. Species values must be in same order as latlong.

testpercentage

Percentage of records used for testing only. If 0 all records will be used for both training and testing.

mintest

Minimim number of total occurrence records of any species to set aside a test set. Only used if testpercentage > 0.

points

If TRUE, force map to include cells with presence records even if suitable habitat was not identified.

runs

If <= 0 no ensemble modelling is performed. If > 0, ensemble modelling with n runs is made. For each run, a new random sample of occurrence records (if testpercentage > 0), background points and predictive variables (if subset > 0) are chosen. In the ensemble model, each run is weighted as max(0, (runAUC - 0.5)) ^ 2.

subset

Number of predictive variables to be randomly selected from layers for each run if runs > 0. If <= 0 all layers are used on all runs. Using a small number of layers is usually better than using many variables for rare species, with few occurrence records (Lomba et al. 2010, Breiner et al. 2015).

Value

Outputs maps in asc, pdf and kml format, plus a file with EOO, AOO and a list of countries where the species is predicted to be present if possible to extract.

References

Breiner, F.T., Guisan, A., Bergamini, A., Nobis, M.P. (2015) Overcoming limitations of modelling rare species by using ensembles of small models. Methods in Ecology and Evolution, 6: 1210-1218.

Lomba, A., Pellissier, L., Randin, C.F., Vicente, J., Moreira, F., Honrado, J., Guisan, A. (2010) Overcoming the rare species modelling paradox: a novel hierarchical framework applied to an Iberian endemic plant. Biological Conservation, 143: 2647-2657.


Map species distribution of habitat specialist.

Description

Mapping of all habitat patches where the species is known to occur.

Usage

map.habitat(
  longlat,
  layer,
  move = TRUE,
  mcp = FALSE,
  points = FALSE,
  eval = TRUE
)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record.

layer

RasterLayer object representing the presence/absence (1/0) of a single habitat type.

move

If TRUE, identifies and moves presence records to closest cells with suitable habitat. Use when spatial error might put records outside the correct patch.

mcp

If TRUE, all habitat patches inside the minimum convex hull polygon encompassing all occurrence records are converted to presence.

points

If TRUE, force map to include cells with presence records even if suitable habitat was not identified.

eval

If TRUE, build a matrix with EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model).

Details

In many cases a species has a very restricted habitat and we generally know where it occurs. In such cases using the distribution of the known habitat patches may be enough to map the species.

Value

One raster object and, if eval = TRUE, a matrix with EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model).


Map recorded distribution of species.

Description

Mapping of all cells where the species is known to occur.

Usage

map.points(longlat, layers, eval = TRUE)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record.

layers

Raster* object as defined by package raster. Any raster with the relevant extent and cell size can be used.

eval

If TRUE, build a matrix with EOO and AOO calculated from occurrence records only.

Details

To be used if either information on the species is very scarce (and it is not possible to model the species distribution) or, on the contrary, complete (and there is no need to model the distribution).

Value

One raster object and, if EVAL = TRUE, a matrix with EOO and AOO.

Examples

records = red.examples("red.records")
layers = red.examples("red.layers")
terra::plot(map.points(records, layers, eval = FALSE))
points(records)

Predict species distributions.

Description

Prediction of potential species distributions using maximum entropy (maxent).

Usage

map.sdm(
  longlat,
  layers,
  error = NULL,
  year = NULL,
  idconf = NULL,
  categorical = NULL,
  thres = 0,
  testpercentage = 0,
  mcp = TRUE,
  points = FALSE,
  eval = TRUE,
  runs = 0,
  subset = 0
)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of each occurrence record.

layers

Predictor variables, a Raster* object as defined by package raster.

error

Vector of spatial error in longlat (one element per row of longlat) in the same unit as longlat. Used to move any point randomly within the error radius.

year

Vector of sampling years in longlat (one element per row of longlat). Used to exclude old records with a given probability proportional to time passed since sampling (never excluded only for current year).

idconf

Vector of identification confidence in longlat (one element per row of longlat). Used to exclude uncertain records with a given probability. Can be on any scale where max values are certain (e.g. from 1 - very uncertain to 10 - holotype).

categorical

Vector of layer indices of categorical (as opposed to quantitative) data. If NULL the package will try to find them automatically based on the data.

thres

Threshold of logistic output used for conversion of probabilistic to binary (presence/absence) maps. If 0 this will be the value that maximizes the sum of sensitivity and specificity.

testpercentage

Percentage of records used for testing only. If 0 all records will be used for both training and testing.

mcp

Used for a precautionary approach. If TRUE, all areas predicted as present but outside the minimum convex hull polygon encompassing all occurrence records are converted to absence. Exceptions are cells connected to other areas inside the polygon.

points

If TRUE, force map to include cells with presence records even if suitable habitat was not identified.

eval

If TRUE, build a matrix with AUC, Kappa, TSS, EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model).

runs

If <= 0 no ensemble modelling is performed. If > 0, ensemble modelling with n runs is made. For each run, a new random sample of occurrence records (if testpercentage > 0), background points and predictive variables (if subset > 0) are chosen. In the ensemble model, each run is weighted as max(0, (runAUC - 0.5)) ^ 2.

subset

Number of predictive variables to be randomly selected from layers for each run if runs > 0. If <= 0 all layers are used on all runs. Using a small number of layers is usually better than using many variables for rare species, with few occurrence records (Lomba et al. 2010, Breiner et al. 2015).

Details

Builds maxent (maximum entropy) species distribution models (Phillips et al. 2004, 2006; Elith et al. 2011) using function maxent from R package dismo (Hijmans et al. 2017). Dismo requires the MaxEnt species distribution model software, a java program that can be downloaded from http://biodiversityinformatics.amnh.org/open_source/maxent. Copy the file 'maxent.jar' into the 'java' folder of the dismo package. That is the folder returned by system.file("java", package="dismo"). You need MaxEnt version 3.3.3b or higher. Please note that this program (maxent.jar) cannot be redistributed or used for commercial or for-profit purposes.

Value

List with either one or two raster objects (depending if ensemble modelling is performed, in which case the second is a probabilistic map from all the runs) and, if eval = TRUE, a matrix with AUC, Kappa, TSS, EOO (from raw data), EOO (from model), AOO (from raw data) and AOO (from model). Aggregate values are taken from maps after transformation of probabilities to incidence, with presence predicted for cells with ensemble values > 0.5.

References

Breiner, F.T., Guisan, A., Bergamini, A., Nobis, M.P. (2015) Overcoming limitations of modelling rare species by using ensembles of small models. Methods in Ecology and Evolution, 6: 1210-1218.

Hijmans, R.J., Phillips, S., Leathwick, J., Elith, J. (2017) dismo: Species Distribution Modeling. R package version 1.1-4. https://CRAN.R-project.org/package=dismo

Lomba, A., Pellissier, L., Randin, C.F., Vicente, J., Moreira, F., Honrado, J., Guisan, A. (2010) Overcoming the rare species modelling paradox: a novel hierarchical framework applied to an Iberian endemic plant. Biological Conservation, 143: 2647-2657.

Phillips, S.J., Dudik, M., Schapire, R.E. (2004) A maximum entropy approach to species distribution modeling. Proceedings of the Twenty-First International Conference on Machine Learning. p. 655-662.

Phillips, S.J., Anderson, R.P., Schapire, R.E. (2006) Maximum entropy modeling of species geographic distributions. Ecological Modelling, 190: 231-259.

Elith, J., Phillips, S.J., Hastie, T., Dudik, M., Chee, Y.E., Yates, C.J. (2011) A statistical explanation of MaxEnt for ecologists. Diversity and Distributions, 17: 43-57.


Move records to closest non-NA cell.

Description

Identifies and moves presence records to cells with environmental values.

Usage

move(longlat, layers, buffer = 0)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

SpatRaster* object as defined by package raster.

buffer

Maximum distance in map units that a record will move. If 0 all NA records will be changed.

Details

Often records are in coastal or other areas for which no environmental data is available. This function moves such records to the closest cells with data so that no information is lost during modelling.

Value

A matrix with new coordinate values.

Examples

rast <- terra::rast(matrix(c(rep(NA,100), rep(1,100), rep(NA,100)), ncol = 15))
pts <- cbind(runif(100, 0, 5), runif(100, 0, 15))
terra::plot(rast)
points(pts)

pts <- move(pts, rast)
terra::plot(rast)
points(pts)

Visual detection of outliers.

Description

Draws plots of sites in geographical (longlat) and environmental (2-axis PCA) space.

Usage

outliers(longlat, layers)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

Raster* object as defined by package raster. It can be any set of environmental layers thought to allow the identification of environmental outliers.

Details

Erroneous data sources or errors in transcriptions may introduce outliers that can be easily detected by looking at simple graphs of geographical or environmental space.

Value

A data.frame with coordinate values and distance to centroid in pca is returned. Two plots are drawn for visual inspection. The environmental plot includes row numbers for easy identification of possible outliers.

Examples

records = red.examples("red.records")
layers = red.examples("red.layers")
outliers(records, layers[[1:3]])

Uniformize raster layers.

Description

Crop raster layers to minimum size possible and uniformize NA values across layers.

Usage

raster.clean(layers)

Arguments

layers

Raster* object as defined by package raster.

Details

Excludes all marginal rows and columns with only NA values and change values to NA if they are NA in any of the layers.

Value

A Raster* object, same class as layers.

Examples

layers = red.examples("red.layers")
terra::plot(raster.clean(layers))

Create distance layer.

Description

Creates a layer depicting distances to records using the minimum, average, distance to the minimum convex polygon or distance taking into account a cost surface.

Usage

raster.distance(longlat, layers, type = "minimum")

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

Raster* object as defined by package raster to serve as model to create distance layer. Cost surface in case of param ="cost".

type

text string indicating whether the output should be the "minimum", "average", or "mcp" distance to all records. "mcp" means the distance to the minimum convex polygon encompassing all records.

Details

Using distance to records in models may help limiting the extrapolation of the predicted area much beyond known areas.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
alt = layers[[3]]
records = red.examples("red.records")
par(mfrow=c(3,2))
terra::plot(alt)
points(records)

terra::plot(raster.distance(records, alt))
terra::plot(raster.distance(records, alt, type = "average"))
terra::plot(raster.distance(records, alt, type = "mcp"))

Create eastness layer.

Description

Create a layer depicting eastness based on an elevation layer.

Usage

raster.east(dem)

Arguments

dem

RasterLayer object of elevation (a digital elevation model - DEM) as defined by package raster.

Details

Using elevation, aspect can be calculated. Yet, it is a circular variable (0 = 360) and has to be converted to northness and eastness to be useful for modelling.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
terra::plot(raster.east(layers[[3]]))

Create latitude layer.

Description

Create a layer depicting latitude based on any other.

Usage

raster.lat(layers)

Arguments

layers

Raster* object as defined by package raster.

Details

Using latitude (and longitude) in models may help limiting the extrapolation of the predicted area much beyond known areas.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
terra::plot(raster.lat(layers[[1]]))

Create longitude layer.

Description

Create a layer depicting longitude based on any other.

Usage

raster.long(layers)

Arguments

layers

Raster* object as defined by package raster.

Details

Using longitude (and latitude) in models may help limiting the extrapolation of the predicted area much beyond known areas.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
terra::plot(raster.long(layers))

Create northness layer.

Description

Create a layer depicting northness based on an elevation layer.

Usage

raster.north(dem)

Arguments

dem

RasterLayer object of elevation (a digital elevation model - DEM) as defined by package raster.

Details

Using elevation, aspect can be calculated. Yet, it is a circular variable (0 = 360) and has to be converted to northness and eastness to be useful for modelling.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
terra::plot(raster.north(layers[[3]]))

Read and buffer raster layers.

Description

Read raster layers of environmental or other variables and crop them to a given extent around the known occurrences.

Usage

raster.read(longlat, layers = NULL, ext = 1)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

Raster* object as defined by package raster.

ext

Either extent of map or buffer around the known records used to crop layers. If buffer, it is relative to the maximum distance between any two records.

Details

If layers are not given, the function will read either 30 arc-second (approx. 1km) or 5 arc-minutes (approx. 10km) resolution rasters from worldclim (Fick & Hijmans 2017) and landcover (Tuanmu & Jetz 2014) if red.setup() is run previously.

Value

A RasterStack object (If no layers are given: Variables 1-19 = bioclim, 20 = elevation, 21-32 = proportion landcover, 33 = most common landcover).

References

Fick, S.E. & Hijmans, R.J. (2017) Worldclim 2: new 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology, in press.

Tuanmu, M.-N. & Jetz, W. (2014) A global 1-km consensus land-cover product for biodiversity and ecosystem modeling. Global Ecology and Biogeography, 23: 1031-1045.

Examples

layers = red.examples("red.layers")
records = red.examples("red.records")
par(mfrow=c(1,2))

terra::plot(layers[[1]])
points(records)

croppedLayers <- raster.read(records, layers, 0.1)
terra::plot(croppedLayers[[1]])
points(records)

Reduce dimensionality of raster layers.

Description

Reduce the number of layers by either performing a PCA on them or by eliminating highly correlated ones.

Usage

raster.reduce(layers, method = "pca", n = NULL, thres = NULL)

Arguments

layers

Raster* object as defined by package raster.

method

Either Principal Components Analysis ("pca", default) or Pearson's correlation ("cor").

n

Number of layers to reduce to.

thres

Value for pairwise Pearson's correlation above which one of the layers (randomly selected) is eliminated.

Details

Using a large number of explanatory variables in models with few records may lead to overfitting. This function allows to avoid it as much as possible. If both n and thres are given, n has priority. If method is not recognized and layers come from raster.read function, only landcover is reduced by using only the dominating landuse of each cell.

Value

A RasterStack object.


Download taxon records from GBIF.

Description

Downloads species or higher taxon data from GBIF and outputs non-duplicate records with geographical coordinates.

Usage

records(taxon)

Arguments

taxon

Taxon name.

Details

As always when using data from multiple sources the user should be careful and check if records "make sense". This can be done by either ploting them in a map (e.g. using red::map.draw()) or using red::outliers().

Value

A data.frame with longitude and latitude, plus species names if taxon is above species.

Examples

rec = records("Nephila senegalensis")
plot(rec)

Example data packaged with *red*

Description

Load data included in the package. This includes *red.records*, a matrix of longitude and latitude (two columns) occurrence records for Hogna maderiana (Walckenaer, 1837); *red.range*, a SpatRaster object, as defined by package terra, of the geographic range of Hogna maderiana (Walckenaer, 1837); *red.layers*, a SpatRaster object with layers representing the average annual temperature, total annual precipitation, altitude and landcover for Madeira Island (Fick & Hijmans 2017, Tuanmu & Jetz 2014); and *worldborders* is a small vector of global country borders.

Usage

red.examples(data = NULL)

Arguments

data

Name of data in quotes. E.g.: '"red.records"' If 'NULL', the example files will be listed.

Source

This function is inspired by 'palmerpanguins::path_to_file()' which in turn is based on 'readxl::readxl_example()'.

Examples

red.examples()
red.examples("red.range")

Read GIS directory.

Description

Read directory where GIS files are stored.

Usage

red.getDir()

Details

Reads a txt file pointing to where the world GIS files are stored.


Setup GIS directory.

Description

Setup directory where GIS files are stored.

Usage

red.setDir(gisPath = NULL)

Arguments

gisPath

Path to the directory where the gis files are stored.

Details

Writes a txt file in the red directory allowing the package to always access the world GIS files directory.


Download and setup GIS files.

Description

Setup red to work with species distribution modelling and layers available online.

Usage

red.setup()

Details

Please check that you have at least 50Gb free in your disk (and a fast internet connection) to download all files. In the end of the process "only" 17.4Gb will be left though. This function will: 1. Check if maxent.jar is available in the dismo package directory. 2. Ask user input for GIS directory. 3. Download global bioclim and elevation files (20) from http://biogeo.ucdavis.edu/data/worldclim/v2.0/tif/base/wc2.0_30s_bio.zip. 4. Download landcover files (12) from http://data.earthenv.org/consensus_landcover/without_DISCover/. 5. Unzip all files and delete the originals. 6. Create a new layer (1) with the dominant land cover at each cell. 7. Resample all files (33) to approximately 10x10km (for use with widespread species) grid cells. Sit back and enjoy, this should take a while.


Red List Index.

Description

Calculates the Red List Index (RLI) for a group of species.

Usage

rli(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)

Arguments

spData

Either a vector with species assessment categories for a single point in time or a matrix with two points in time in different columns (species x date). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX).

tree

An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity).

boot

If TRUE bootstrapping for statistical significance is performed on both values per date and the trend between dates.

dd

bootstrap among all species (FALSE) or Data Deficient species only (TRUE).

runs

Number of runs for bootstrapping

Details

The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.). To incorporate Importantly, the RLI is based on true improvements or deteriorations in the status of species, i.e. genuine changes. It excludes category changes resulting from, e.g., new knowledge (Butchart et al. 2007). The RLI approach helps to develop a better understanding of which taxa, regions or ecosystems are declining or improving. Juslen et al. (2016a, b) suggested the use of bootstrapping to search for statistical significance when comparing taxa or for trends in time of the index and this approach is here implemented.

Value

Either a vector (if no two dates are given) or a matrix with the RLI values and, if bootstrap is performed, their confidence limits and significance.

References

Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.

Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.

Juslen, A., Cardoso, P., Kullberg, J., Saari, S. & Kaila, L. (2016a) Trends of extinction risk for Lepidoptera in Finland: the first national Red List Index of butterflies and moths. Insect Conservation and Diversity, 9: 118-123.

Juslen, A., Pykala, J., Kuusela, S., Kaila, L., Kullberg, J., Mattila, J., Muona, J., Saari, S. & Cardoso, P. (2016b) Application of the Red List Index as an indicator of habitat change. Biodiversity and Conservation, 25: 569-585.

Examples

rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","DD","DD"), ncol = 2, byrow = TRUE)
colnames(rliData) <- c("2000", "2010")
rli(rliData[,1])
rli(rliData[,1], boot = TRUE)
rli(rliData)
rli(rliData, boot = TRUE, dd = TRUE)

Mapping the Red List Index.

Description

Creates a map for the red list index according to species distribution and threat status.

Usage

rli.map(spData, layers, layers2 = NULL, tree = NULL)

Arguments

spData

Either a vector with species assessment categories for a single point in time or a matrix with two points in time in different columns (species x date). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX).

layers

Species distributions (0/1), a Raster* object as defined by package raster.

layers2

Species distributions (0/1) on the second point in time, a Raster* object as defined by package raster. If there are two dates but no layers2, the distributions are assumed to be kept constant in time.

tree

An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity).

Details

The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.).

Value

A RasterLayer with point values (if a single date is given) or change per cell (if two dates are given).

References

Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.

Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.

Examples

sp1 <- terra::rast(matrix(c(1,1,1,0,0,0,0,0,NA), ncol = 3))
sp2 <- terra::rast(matrix(c(1,0,0,1,0,0,1,0,NA), ncol = 3))
sp3 <- terra::rast(matrix(c(1,0,0,0,0,0,0,0,NA), ncol = 3))
sp4 <- terra::rast(matrix(c(0,1,1,1,1,1,1,1,NA), ncol = 3))
layers <- c(sp1, sp2, sp3, sp4)
spData <- c("CR","EN","VU","LC")
terra::plot(rli.map(spData, layers))

Red List Index for multiple groups.

Description

Calculates the Red List Index (RLI) for multiple groups of species.

Usage

rli.multi(spData, tree = NULL, boot = FALSE, dd = FALSE, runs = 1000)

Arguments

spData

A matrix with group names (first column) and species assessment categories for one or two points in time (remaining columns). Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX).

tree

A list of hclust or phylo objects, each corresponding to a tree per group (used when species are weighted by their unique contribution to phylogenetic or functional diversity).

boot

If TRUE bootstrapping for statistical significance is performed on both values per date and the trend between dates.

dd

bootstrap among all species (FALSE) or Data Deficient species only (TRUE).

runs

Number of runs for bootstrapping

Details

The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to 5 (Extinct/Extinct in the Wild). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Each species weight can further be influenced by how much it uniquely contributes to the phylogenetic or functional diversity of the group (Cardoso et al. in prep.). Importantly, the RLI is based on true improvements or deteriorations in the status of species, i.e. genuine changes. It excludes category changes resulting from, e.g., new knowledge (Butchart et al. 2007). The RLI approach helps to develop a better understanding of which taxa, regions or ecosystems are declining or improving. Juslen et al. (2016a, b) suggested the use of bootstrapping to search for statistical significance when comparing taxa or for trends in time of the index and this approach is here implemented.

Value

A matrix with the RLI values and, if bootstrap is performed, their confidence limits and significance.

References

Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PloS Biology, 2: 2294-2304.

Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PloS One, 2: e140.

Juslen, A., Cardoso, P., Kullberg, J., Saari, S. & Kaila, L. (2016a) Trends of extinction risk for Lepidoptera in Finland: the first national Red List Index of butterflies and moths. Insect Conservation and Diversity, 9: 118-123.

Juslen, A., Pykala, J., Kuusela, S., Kaila, L., Kullberg, J., Mattila, J., Muona, J., Saari, S. & Cardoso, P. (2016b) Application of the Red List Index as an indicator of habitat change. Biodiversity and Conservation, 25: 569-585.

Examples

rliData <- matrix(c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX"), ncol = 2, byrow = TRUE)
colnames(rliData) <- c("2000", "2010")
rliData <- cbind(c("Arthropods","Arthropods","Birds","Birds","Birds"), rliData)
rli.multi(rliData[,1:2])
rli.multi(rliData[,1:2], boot = TRUE)
rli.multi(rliData)
rli.multi(rliData, boot = TRUE)

Prediction of Red List Index.

Description

Linearly interpolates and extrapolates RLI values to any years.

Usage

rli.predict(rliValue, from = NA, to = NA, rliPlot = FALSE)

Arguments

rliValue

Should be a vector with RLI values and names as the corresponding year numbers.

from

Starting year of the sequence to predict.

to

Ending year of the sequence to predict.

rliPlot

Plots the result

Details

The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa.

Value

A matrix with the RLI values and confidence limits.

Examples

rliValue <- c(4.5, 4.3, 4.4, 4.2, 4.0)
names(rliValue) <- c(2000, 2004, 2008, 2011, 2017)
rli.predict(rliValue, 1990, 2020)

Sampled Red List Index.

Description

Calculates accumulation curve of confidence limits in sampled RLI.

Usage

rli.sampled(spData, tree = NULL, p = 0.05, runs = 1000)

Arguments

spData

A vector with species assessment categories for a single point in time. Values can be text (EX, EW, RE, CR, EN, VU, NT, DD, LC) or numeric (0 for LC, 1 for NT, 2 for VU, 3 for EN, 4 for CR, 5 for RE/EW/EX).

tree

An hclust or phylo object (used when species are weighted by their unique contribution to phylogenetic or functional diversity).

p

p-value of confidence limits (in a two-tailed test).

runs

Number of runs for smoothing accumulation curves.

Details

The IUCN Red List Index (RLI) (Butchart et al. 2004, 2007) reflects overall changes in IUCN Red List status over time of a group of taxa. The RLI uses weight scores based on the Red List status of each of the assessed species. These scores range from 0 (Least Concern) to Extinct/Extinct in the Wild (5). Summing these scores across all species and relating them to the worst-case scenario, i.e. all species extinct, gives us an indication of how biodiversity is doing. Yet, in many groups, it is not possible to assess all species due to huge diversity and/or lack of resources. In such case, the RLI is estimated from a randomly selected sample of species - the Sampled Red List Index (SRLI; Stuart et al. 2010). This function allows to calculate how many species are needed to reach a given maximum error of the SRLI around the true value of the RLI (with all species included) for future assessments of the group.

Value

A vector with the accumulation of the error of the SRLI around the true value of the RLI (with all species included).

References

Butchart, S.H.M., Stattersfield, A.J., Bennun, L.A., Shutes, S.M., Akcakaya, H.R., Baillie, J.E.M., Stuart, S.N., Hilton-Taylor, C. & Mace, G.M. (2004) Measuring global trends in the status of biodiversity: Red List Indices for birds. PLoS Biology, 2: 2294-2304.

Butchart, S.H.M., Akcakaya, H.R., Chanson, J., Baillie, J.E.M., Collen, B., Quader, S., Turner, W.R., Amin, R., Stuart, S.N. & Hilton-Taylor, C. (2007) Improvements to the Red List index. PLoS One, 2: e140.

Stuart, S.N., Wilson, E.O., McNeely, J.A., Mittermeier, R.A. & Rodriguez, J.P. (2010) The barometer of Life. Science 328, 117.

Examples

rliData <- c("LC","LC","EN","EN","EX","EX","LC","CR","CR","EX")
rli.sampled(rliData)

Spatial thinning of occurrence records.

Description

Thinning of records with minimum distances either absolute or relative to the species range.

Usage

thin(longlat, distance = 0.01, relative = TRUE, runs = 100)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

distance

Distance either in relative terms (proportion of maximum distance between any two records) or in raster units.

relative

If TRUE, represents the proportion of maximum distance between any two records. If FALSE, is in raster units.

runs

Number of runs

Details

Clumped distribution records due to ease of accessibility of sites, emphasis of sampling on certain areas in the past, etc. may bias species distribution models. The algorithm used here eliminates records closer than a given distance to any other record. The choice of records to eliminate is random, so a number of runs are made and the one keeping more of the original records is chosen.

Value

A matrix of species occurrence records separated by at least the given distance.

Examples

records <- matrix(sample(100), ncol = 2)
par(mfrow=c(1,2))
graphics::plot(records)
records <- thin(records, 0.1)
graphics::plot(records)