A check to run before modelling. A model can only learn the part of a species' response that the calibration area (M) contains. If the records are still frequent where the conditions of M end, the limit of the niche on that variable lies outside M: the response is truncated, and projecting the model to conditions beyond M (another period, scenario or region) extrapolates a curve whose end was never seen (Thuiller et al. 2004; Chevalier et al. 2021). The function reports, for every layer and for both ends of its range:
Usage
niche_truncation(
points,
env,
projections = NULL,
edge = 0.05,
edge_ratio = 1,
min_share = 0.01,
n = 1e+05,
edge_check = c(0.01, 0.025, 0.05, 0.1),
effort = NULL,
coords = NULL,
points_crs = "EPSG:4326",
seed = 1
)Arguments
- points
Records: a data.frame, CSV path,
sfor terra::SpatVector.- env
Predictor layers of the calibration area, e.g. from
crop_to_m()(terra::SpatRaster or file paths).- projections
Optional named list of rasters to project to (other periods, scenarios or regions) with the same layer names.
- edge
Share of M's conditions that counts as its margin.
- edge_ratio
edge_*at or above which an end is called truncated.Share of a projection's cells beyond M above which a truncated end is a risk.
- n
Number of cells sampled from M and from each projection.
- edge_check
Other margins at which the diagnosis is repeated; the printout says whether truncation is found at all of them or only at some, and
edge_stabilityholds the details.- effort
Optional recording-effort raster (e.g. from
gbif_effort_rasters()). Records crowding at a limit of M can come from intense recording there, and a margin without records can be one that nobody recorded:effort_low/effort_highgive the mean effort in each margin relative to M, andevidence_*grade what that means (above 2 for a truncated end: weaker evidence; below 0.5 for an end that is not truncated: truncation cannot be ruled out; preENM defaults, not from the literature).- coords
Names of the coordinate columns, if not recognised.
- points_crs
CRS of the coordinates.
- seed
Seed for the cell samples.
Value
A niche_truncation object: a list with variables (one row
per layer), projections (one row per projection and layer, or
NULL), ranges (the quantiles drawn by plot_niche_truncation()),
edge_stability (one row per layer and end: at how many of the
margins in edge_check the end is truncated, which ones, and a
verdict: all edges, some edges or no edge) and settings.
Details
gap_low,gap_high: the distance between the most extreme record and the most extreme conditions of M, as a share of M's range (0 = the records reach the limit of M).edge_low,edge_high: how often records fall in the outeredge(default 5%) of M's conditions, relative to how common those conditions are in M. About 0 means that the species avoids the margin, so its limit lies inside M; 1 means that it uses the margin as often as M offers it; above 1, that it prefers it.truncated_low,truncated_high:edge_*at or aboveedge_ratio.
With projections it also gives the share of cells of each projection
that lie outside the conditions of M and outside those of the records,
and marks as risk_low / risk_high the layers that are truncated at an
end beyond which the projection has more than min_share of its cells.
For those, consider a larger M (so that the limit is sampled), another
variable, or clamping and a cautious reading of the projection.
The flags are a screening aid, not a test: a species may truly live up
to the edge of M because M ends at a coast or a mountain crest. Records
concentrated near an edge because of sampling bias inflate edge_*;
run it on thinned records (thin_by_cell(), thin_environment()).
What next. truncation_remedy() takes this result and layers
extending beyond M, and proposes what to do: extend M towards the
missing conditions, look for records in donor regions, or accept the
truncation; it also prepares the datasets of a spatially nested model.
With records of the whole range, niche_coverage() measures how much of
the niche a region misses.
Assumptions and limits. The edge (edge, default 5%) is a screening
choice, not a biological threshold. Records crowding at a limit of M can
also come from sampling bias near that limit, a discontinuous
distribution or predictors that do not limit the species, so read the
result together with recording effort and niche_coverage().
References
Thuiller, W., Brotons, L., Araujo, M.B., Lavorel, S. (2004) Effects of restricting environmental range of data to project current and future species distributions. Ecography 27, 165-172. Chevalier, M., Broennimann, O., Cornuault, J., Guisan, A. (2021) Data integration methods to account for spatial niche truncation effects in regional projections of species distribution. Ecological Applications 31, e02427.
Examples
sim <- simulate_enm_data(seed = 1, n_presence = 150)
# a calibration area that is too small: only the western part, where
# env1 stops at 0.7 although the species goes on to the east
m <- terra::crop(sim$env, terra::ext(14, 21, 49, 55))
tr <- niche_truncation(sim$presence, m,
projections = list(whole_area = sim$env))
tr
#> Niche truncation: 110 records, 3360 cells of M; margin = outer 5% of M's conditions
#> Truncated: env1 (high end)
#> Other margins (1%, 2.5%, 5%, 10%): the diagnosis depends on the margin for env2 (low end; truncated at 0.01); read these with care
#> Truncated at every margin: env1 (high end)
#>
#> layer m_min m_max rec_min rec_max gap_low gap_high edge_low edge_high
#> env1 0.00625 0.694 0.09380 0.694 0.127 0.000 0.000 1.02
#> env2 0.00833 0.992 0.00833 0.892 0.000 0.102 0.727 0.00
#> truncated_low truncated_high
#> FALSE TRUE
#> FALSE FALSE
#>
#> Projections (share of cells outside M and outside the records)
#> Truncated ends that a projection goes beyond: env1 in whole_area
#>
#> projection layer below_m above_m below_records above_records risk_low
#> whole_area env1 0 0.3 0.0875 0.3 FALSE
#> whole_area env2 0 0.0 0.0000 0.1 FALSE
#> risk_high
#> TRUE
#> FALSE
#>
#> A preENM sensitivity analysis: how much the result depends on the margin
#> that defines the edge of M. The others are listed in ?sensitivity_analyses.
plot_niche_truncation(tr)
