Skip to contents

Asks, for every record, how much the predictors vary within its coordinate uncertainty, instead of judging the uncertainty in metres. A record with an uncertainty of 5 km on a plain has almost the same climate wherever it truly lies and is safe to use; one with 1 km on a steep slope may not be. Records are usually dropped above a fixed uncertainty (see max_coord_unc_m in filter_settings()), which discards many usable records, often the older ones and those from poorly sampled regions, and so narrows the sampled niche (Smith et al. 2023; Marcer et al. 2022).

Usage

uncertainty_environment(
  points,
  env,
  uncertainty = NULL,
  max_rel = 0.1,
  breadth_probs = c(0.05, 0.95),
  max_radius_km = 20,
  na_uncertainty = NA,
  coords = NULL,
  points_crs = "EPSG:4326",
  verbose = TRUE
)

Arguments

points

Records: a data.frame, CSV path, sf or terra::SpatVector.

env

Predictor layers (terra::SpatRaster or file paths).

uncertainty

The coordinate uncertainty in metres: a column name (default: coordinateUncertaintyInMeters or uncertainty, whichever exists), one value per record, or a single value for all.

max_rel

Largest acceptable range within the uncertainty, as a share of the species' niche breadth, on any layer.

breadth_probs

Quantiles of the values at the records that define the niche breadth.

max_radius_km

Records with a larger uncertainty are not examined and get unc_ok = FALSE (their circles cover very many cells).

na_uncertainty

Uncertainty (m) assumed for records without one; NA leaves them undecided.

coords

Names of the coordinate columns, if not recognised.

points_crs

CRS of the coordinates.

verbose

Print a summary.

Value

The records (data.frame) with added columns: unc_m (the uncertainty used), unc_cells (cells touched by the circle), unc_rel_<layer> (range within the circle / niche breadth, one column per layer), unc_rel_max (the largest of them), unc_limiting (its layer), unc_ok and unc_action ("keep", "propagate" or "drop"). attr(, "breadth") holds the niche breadth of each layer.

Details

For each record, the cells that its uncertainty circle touches are found (the record's own cell always counts) and the range of each layer among them is divided by the species' niche breadth on that layer: the distance between the breadth_probs quantiles (default 5% and 95%) of the values at all records. A relative range of 0.1 means that the true value may differ by up to a tenth of the breadth of the species' niche on that variable. unc_ok is TRUE when no layer exceeds max_rel.

Use the layers you will model with (or their main gradients, e.g. temperature and precipitation), at the resolution you will model at. Typical use: run filter_occurrences() with a generous max_coord_unc_m (or none), then keep the records with unc_ok.

Decide or propagate. Instead of dropping the records whose environment varies, they can be kept and their uncertainty propagated into the models with jitter_uncertainty(), which samples the same quantity (the range of the predictors within the radius, relative to the niche breadth) by moving the records in replicate datasets. unc_action says which: "keep" (the environment is uniform within the radius; the record can be used as it is), "propagate" (it varies; drop the record, or keep it and propagate) and "drop" (radius above max_radius_km, not examined). Records without an uncertainty get NA (decide yourself, or set na_uncertainty to an assumed value in metres).

Coordinate uncertainty and grain. The variation is measured on the grid given. A record accurate to 10 m still has environmental uncertainty when the cell is 1 km wide and the landscape varies within it, but that is hidden by the grid; see grain_sensitivity() for the effect of the grain itself.

Status. A preENM method; Gabor et al. (2023) studied the effect of positional error on the models themselves.

References

Smith, A.B., Murphy, S.J., Henderson, D., Erickson, K.D. (2023) Including imprecisely georeferenced specimens improves accuracy of species distribution models and estimates of niche breadth. Global Ecology and Biogeography 32, 342-355.

Marcer, A., Chapman, A.D., Wieczorek, J.R., Pico, F.X., Uribe, F., Waller, J., Arino, A.H. (2022) Uncertainty matters: ascertaining where specimens in natural history collections come from and its implications for predicting species distributions. Ecography 2022, e06025.

Gabor, L., Jetz, W., Zarzo-Arias, A., et al. (2023) Species distribution models affected by positional uncertainty in species occurrences can still be ecologically interpretable. Ecography 2023, e06358. doi:10.1111/ecog.06358

Examples

sim <- simulate_enm_data(seed = 1, n_presence = 60)
occ <- sim$presence
set.seed(2)
occ$coordinateUncertaintyInMeters <- sample(c(100, 5000, 30000, NA), 60,
                                            replace = TRUE)
u <- uncertainty_environment(occ, sim$env, max_radius_km = 40)
#> Records: 60; usable (range within the uncertainty <= 0.1 of the niche breadth on every layer): 31; too uncertain: 15; undecided (no uncertainty, coordinates or values): 14
#> Limiting layer of the records that are too uncertain: env1 (11), env2 (4)
table(uncertainty_m = u$unc_m, usable = u$unc_ok, useNA = "ifany")
#>              usable
#> uncertainty_m FALSE TRUE <NA>
#>         100       0   17    0
#>         5000      0   14    0
#>         30000    15    0    0
#>         <NA>      0    0   14