Performance metrics do not tell whether a model responds to the
environment in an ecologically plausible way. A model can score well and
still have an implausible response, which then extrapolates badly under
climate change (Fiorentino et al. 2025); machine-learning models in
particular overfit into irregular responses that conventional metrics do
not reveal (Chollet Ramampiandra et al. 2023). The shape of the response
also decides how a model behaves under novel conditions: predictions hold
up where new conditions fall near the optimum and fail in the tails
(Allyn et al. 2025), and models trained on a truncated niche extrapolate
worse (Yau et al. 2026). response_check() describes every response
curve so that implausible ones can be found before the model is used.
Usage
response_check(
x,
variable = "variable",
value = "value",
suitability = "suitability",
model = "model",
run = "run",
pred = "pred",
occurrences = NULL,
background = NULL,
calibration = NULL,
projection = NULL,
n_bins = 30,
tolerance = 0.05,
flat = 0.05,
max_wiggle = 3,
edge = 0.1,
seed = 1
)Arguments
- x
Response curves (long table) or raw predictions (wide table); see Details.
- variable, value, suitability, model, run
Column names of the long table (
modelandrunare optional).- pred
For raw predictions, the column with the predictions; the other numeric columns (except
model,run) are the predictors.- occurrences
Optional predictor values at the presences (data.frame with one column per variable).
- background
Optional predictor values at the background points.
- calibration
Optional predictor values defining the calibrated range (default:
backgroundandoccurrences).- projection
Optional predictor values of a projection: a data.frame, or rasters (terra::SpatRaster; a sample of cells is read).
- n_bins
Number of classes for raw predictions.
- tolerance
Smallest reversal counted as a turning point, and smallest rise at an edge, as a share of the curve's range.
- flat
A curve whose suitability varies less than this is flat.
- max_wiggle
Wiggliness above which a curve is irregular.
- edge
Share of the calibrated range at each end used to judge whether the curve is still rising.
- seed
Seed for the sample of cells of a
projectionraster.
Value
A list of class response_check: shapes (one row per curve:
model, run, variable, shape, turning_points, wiggliness,
range, optimum, optimum_position, rising_low, rising_high,
agreement, beyond_low, beyond_high), curves (the curves
used), density (the record density along each gradient), limits
(calibrated range per variable) and settings.
Details
Input. The response curves from your modelling software: a long
table with the predictor (variable), its value (value) and the
predicted suitability (suitability), optionally per model and run
(as exported by biomod2, ENMeval, maxnet, predicts, pdp, ...).
Alternatively, raw predictions with the predictor values at the same
points (one column per predictor and a pred column): the response is
then the mean prediction in n_bins classes of each predictor. That is
a marginal response, which mixes in the effects of correlated
predictors; partial-dependence or "evaluation strip" curves from the
modelling software are better. Bin means carry sampling noise, so for
them a turning point must also exceed 3 x sqrt(2) median standard errors
of the bin means.
Per curve (variable x model x run):
turning_points: reversals of the curve (a rise followed by a fall or the reverse) larger thantoleranceof the curve's range, so that small numerical noise is not counted.wiggliness: the total variation of the curve divided by its range: 1 for a monotonic curve, at most 2 for a curve with one peak, larger the more the curve goes up and down.shape:"flat"(range belowflat),"increasing","decreasing"(no turning point),"unimodal"(one peak),"U-shaped"(one trough; rarely plausible for suitability) or"irregular"(more turning points, or wiggliness abovemax_wiggle).optimum: the predictor value with the highest suitability, andoptimum_position, its position in the calibrated range (0 = lower edge, 1 = upper edge).rising_low,rising_high: suitability still rising towards the lower or upper edge of the calibrated range (by more thantoleranceof the range over the outermostedgeshare of the range). Beyond such an edge the prediction depends on how the algorithm extrapolates (clamping, a straight continuation or a drop); this is whereextrapolation_risk()andenvironment_shift()matter most.
Records. With occurrences (predictor values at the presences), the
density of the records along each gradient is compared with the curve
(agreement, the Spearman correlation between the curve and the
density). With background too, the ratio of presence to background
density is used, which follows the response of the species rather than
the availability of conditions; without it, the density of records also
reflects which conditions are common. The calibrated range is the range
of calibration (default: background and occurrences, else the
curve itself).
Reading the shapes: which curve is plausible? There is no single correct shape; what to expect depends on the gradient and on how much of it the data cover.
Along a direct gradient (one acting on the physiology, such as temperature or pH) a species is expected to respond with a bell: the highest suitability at its optimum, falling towards zero beyond its tolerance; narrow or broad, symmetric or skewed, with a peak or a plateau at the optimum (Austin 2002; Fiorentino et al. 2025).
Along a resource gradient (water, nutrients) a rise that levels off (a plateau) is plausible: more of the resource helps until it no longer limits.
A monotonic curve is plausible when the data cover only one side of the niche, e.g. a cold-adapted species whose warm limit lies inside the area but whose cold limit lies beyond it. Then it is still rising at an edge (
rising_low/rising_high), and the response beyond that edge is unknown: it is a truncated niche, not a wrong model (seeniche_truncation()).Along an indirect gradient (elevation, latitude), which acts through others, any shape can arise, and the curve says little about the species.
Irregular curves (several peaks, steps) and U-shapes are rarely plausible; they usually mean the model fits noise or follows where records happen to lie (Chollet Ramampiandra et al. 2023).
The curve should not follow how common the values of a predictor are in
the area (the distribution of the raster, which is often unimodal
itself), but how much more often the species is found at a value than
that value is available. That is why the agreement uses the ratio of
presence to background density when background is given: without it,
a bell-shaped density of records can simply mirror a bell-shaped
availability of the conditions.
Projection. With projection (predictor values of the area or
period the model is projected to: a data.frame or rasters), the share of
it beyond each edge where the curve is still rising is reported.
Background drawn evenly in environmental space, as
sample_background(method = "envstrat") does, makes response curves
closer to the true response of the species (Broussin et al. 2024).
Status and limits. A preENM method. The plausible shapes are expectations, not laws: a bimodal response can be real (e.g. two ecotypes), and a plausible-looking curve can still be wrong. The checks see only the curves supplied, and marginal and partial responses differ when predictors are correlated.
References
Fiorentino, D., Nunez-Riboni, I., Pierce, M.E., Oesterwind, D., Akimova, A. (2025) Improving species distribution models for climate change studies: ecological plausibility and performance metrics. Ecological Modelling 508, 111207. doi:10.1016/j.ecolmodel.2025.111207
Austin, M.P. (2002) Spatial prediction of species distribution: an interface between ecological theory and statistical modelling. Ecological Modelling 157, 101-118. doi:10.1016/S0304-3800(02)00205-3
Chollet Ramampiandra, E., Scheidegger, A., Wydler, J., Schuwirth, N. (2023) A comparison of machine learning and statistical species distribution models: quantifying overfitting supports model interpretation. Ecological Modelling 481, 110353. doi:10.1016/j.ecolmodel.2023.110353
Allyn, A.J. et al. (2025) Contrasting species distribution model predictability under novel temperature conditions. Diversity and Distributions 31, e70036. doi:10.1111/ddi.70036
Yau, E.Y.H., Bonebrake, T.C., Hughes, A.C. (2026) Optimizing species distribution models for extrapolation - guidance through algorithm, variable, and ensemble modelling decisions. Ecological Informatics 99, 104008. doi:10.1016/j.ecoinf.2026.104008
Broussin, J., Mouchet, M., Goberville, E. (2024) Generating pseudo-absences in the ecological space improves the biological relevance of response curves in species distribution models. Ecological Modelling 498, 110865. doi:10.1016/j.ecolmodel.2024.110865
Examples
v <- seq(0, 30, length.out = 60)
curves <- rbind(
data.frame(model = "GLM", variable = "temp", value = v,
suitability = exp(-(v - 15)^2 / 40)),
data.frame(model = "RF", variable = "temp", value = v,
suitability = pmin(1, exp(-(v - 15)^2 / 40) +
0.3 * (sin(v) > 0.6))),
data.frame(model = "GLM", variable = "rain", value = v,
suitability = plogis((v - 10) / 3)))
set.seed(1)
occ <- data.frame(temp = rnorm(200, 15, 4), rain = runif(200, 5, 30))
rc <- response_check(curves, occurrences = occ)
rc
#> Response check: 3 curve(s), 2 variable(s), 2 model(s)
#>
#> IN SHORT
#> - Shapes: 1 unimodal, 1 increasing, 1 irregular.
#> - Implausible shapes: temp (RF). Irregular responses (several turning
#> points or a curve that goes up and down) usually mean the model fits
#> noise, and U-shaped responses rarely make ecological sense; check these
#> models before using their projections.
#> - Every curve follows the records along its gradient (agreement 0.3 or
#> more).
#>
#> model variable shape turning_points wiggliness optimum optimum_position
#> GLM temp unimodal 1 2.0 14.75 0.47
#> RF temp irregular 9 4.1 13.22 0.38
#> GLM rain increasing 0 1.0 30.00 1.00
#> rising_low rising_high agreement
#> FALSE FALSE 0.99
#> FALSE FALSE 0.91
#> FALSE FALSE 0.61
#>
#> turning_points = reversals larger than 5% of the curve's range; wiggliness =
#> total variation / range (1 = monotonic, up to 2 = one peak); irregular = two
#> or more turning points or wiggliness above 3; flat = range below 0.05.
#> rising_low/high = still rising over the outer 10% of the calibrated range.
#> optimum_position: 0 = lower edge, 1 = upper edge. agreement = Spearman
#> correlation between the curve and the density of records. All limits are
#> preENM defaults, not from the literature.
plot_response_check(rc)
