Species ecological ranges provide the ecological limits within which the species can survive or reproduce within the ecosystem. These ranges are usually obtained from experimental setups or continued data collection. However, the species’ ecological ranges may vary due to colonization of new ranges. Therefore, if the species ecological ranges are available, then records obtained outside the ranges can be flagged as outliers that require further analysis.
The sources of species ecological ranges include standard
databases such as FishBase (Froese and Pauly 2014),
www.freshwaterecology.info (Schmidt-Kloiber and Hering 2015),
or the International Union for Conservation of Nature. Linking to these
databases is not outside the scope of this package. Still, a user can
collate a table of species’ ecological ranges and use it in this
package’s multidetect function to flag
outliers.
This method of using species ecological ranges is concertedly used with the other outlier detection methods, including univariate and multivariate methods, as shown below.
1 Loading example datasets
data("jdsdata")
data("efidata")
wcd <- terra::rast(system.file('extdata/worldclim.tiff', package = "specleanr"))
#match and clean
matchd <- match_datasets(datasets = list(jds= jdsdata, efi =efidata),
lats = 'lat', lons = 'lon',
country = 'JDS4_site_ID',
species = c('scientificName', 'speciesname'),
date=c('sampling_date','Date'))
#matchclean <- check_names(matchd, colsp = 'species', verbose = FALSE, merge = TRUE)
db <- sf::read_sf(system.file('extdata/danube.shp.zip',
package = "specleanr"), quiet = TRUE)2. Extracting environmental predictors from worldclim dataset
refdata <- pred_extract(data = matchd, raster = wcd,
lat = 'decimalLatitude',
lon = 'decimalLongitude',
bbox = db,
colsp = 'species',
list = TRUE,
verbose = FALSE,
minpts = 6,
merge = FALSE)3. Preparing ecological ranges for Squalius cephalus
NOTE
optdata includes five columns, including 1)
species, which indicates the species names being studied. The
names should be the same as those in the reference dataset. 2)
mintemp is the minimum temperature of the species (lower
ecological limit). 3) maxtemp is the species’ maximum
temperature (upper ecological limit). 4) meantemp is
the species mean temperature, and 5) direction, which
signifies whether it is greater or lower than in the case of the mean
temperature.
sqcep <- refdata["Squalius cephalus"]
optdata <- data.frame(species= c("Squalius cephalus", "Abramis brama"),
mintemp = c(6, 1.6),maxtemp = c(8.588, 21),
meantemp = c(8.5, 10.4), #ecoparam
direction = c('greater', 'greater'))4. Outlier detection with univariate, multivariate and species ecological ranges
multiple parameter is set to TRUE even
when one species is considered because the data is extracted from
refdata dataset that has multiple species.optpar is provided in a list format and since the
mintemp and maxtemp are provided, then the
dirction of whether greater or lower are not required to be set.
ggenvironmentalspace(squalius_qc_labeled,
type = '1D',
ggxangle = 45,
scalecolor = 'viridis',
xhjust = 1,
legend_position = 'blank',
ylab = "Number of records",
xlab = "Outlier labels")