
Where does a projection leave the conditions of the calibration data?
Source:R/extrapolation.R
extrapolation_risk.RdMaps how far the conditions of a projection (another period, scenario or region) are from those the model was calibrated on, with the two standard measures, so that predictions there can be masked or read with caution:
Usage
extrapolation_risk(
reference,
projection,
mop_share = 0.1,
n_ref = 5000,
seed = 1,
filename = "",
overwrite = FALSE
)Arguments
- reference
The calibration conditions: the rasters of the calibration area (M), from which
n_refcells are sampled, or a matrix or data.frame of values (e.g. at the records and background points used for fitting).- projection
Rasters to project to, with the same layer names.
Share of the reference used as nearest neighbours of
mop(Owens et al. used 0.1).- n_ref
Number of reference cells sampled from a raster.
- seed
Seed for the sample.
- filename
Optional output file.
- overwrite
Overwrite
filename.
Value
A terra::SpatRaster with the five layers.
Details
| Layer | Meaning |
nt1 | ExDet novelty of single variables: 0 inside the reference range of every variable, negative outside (the sum over variables of the distance beyond the range, in units of the range) |
nt2 | ExDet novelty of combinations: Mahalanobis distance to the reference centre divided by the largest such distance in the reference; above 1 = a combination of values that the reference lacks, even if each value is within range |
mop | mobility-oriented parity: mean distance, in standardised units, to the nearest mop_share of the reference; larger = less similar |
n_outside | number of variables outside the reference range |
most_novel | the variable farthest outside its reference range (its position in names(reference); NA where none is outside) |
nt1 and n_outside show strict extrapolation; nt2 detects new
combinations (e.g. warm and wet where the reference has warm and dry),
which MESS and range checks miss; mop grades similarity also inside
the reference range. niche_truncation() summarises the same question
per variable in a table; this function maps it.
A clustered reference. MOP measures the distance to the nearest
tenth of the reference points, so a reference made of clustered records
makes everything far from the clusters look novel: in the validation in
validation/validate_mop.R (an area sampled evenly or 20 times more
densely in one corner), MOP distances nearly doubled and the two maps
correlated at 0.79, while ExDet novelty agreed in 98% of cells. Use an
even sample of the calibration area (the raster, or the background
points) as reference, not the records alone.
Novelty is not uncertainty. These maps show environmental novelty: how
far conditions lie outside the reference data. A novel cell can still get
similar predictions from all models, and models can disagree in familiar
conditions. Model disagreement is mapped by ensemble_models() and its
sources by partition_uncertainty(); neither covers ecological
uncertainty such as adaptation or new biotic interactions.
References
Mesgaran, M.B., Cousens, R.D., Webber, B.L. (2014) Here be dragons: a tool for quantifying novelty due to covariate range and correlation change when projecting species distribution models. Diversity and Distributions 20, 1147-1159. Owens, H.L. et al. (2013) Constraints on interpretation of ecological niche models by limited environmental ranges on calibration areas. Ecological Modelling 263, 10-18.
Examples
sim <- simulate_enm_data(seed = 1)
m <- terra::crop(sim$env, terra::ext(14, 21, 49, 55)) # calibration area
ex <- extrapolation_risk(m, sim$env)
terra::plot(ex[[c("nt1", "nt2", "mop")]])