Skip to contents

Ensembles, thresholds, range metrics, projected change against the study design, sources of uncertainty and data sparseness.

21. Ensembles and disagreement

ensemble_models() takes the prediction rasters of the models (a SpatRaster or files/folders, from any software) and the result of select_models() or evaluate_models(), and returns the ensemble together with the disagreement between the models in every cell:

ens <- ensemble_models(sim$models, sel)          # PCAm of the selected models
ens                                              # where do the models disagree?
plot_ensemble(ens, file = "ensemble.pdf")        # ensemble and SD side by side
ensemble_models(prediction_folder, sel, method = "pcam",
                filename = "ensemble.tif")       # large rasters, written to disk
Median of the selected models and the standard deviation between them
Median of the selected models and the standard deviation between them
  • Which models: only the selected models of select_models(), or the Pareto front of evaluate_models(); dominated or unselected models are left out (use = "all" keeps them all).
  • How they are combined: "pcam" (default: the median of the half of the models closest to their common trend, the first principal component of the standardised predictions; with fewer than three models the median; plot_ensemble_pca() shows the loadings, and the printout warns when the first component explains less than half of the variance, so that there is hardly a common trend), "median", "mean" or "weighted" (weights 1 - distance, the compromise score of the evaluation, or your own weights). Models on 0-100 or 0-1000 are brought to 0-1 first (see Prediction scales).
  • Why weighting is not the default: weights based on the evaluation reward predicting the data the models were evaluated on, which is not the same as predicting new areas or periods. In transfers across continents, consensus models weighted by AUC were worse than the median of the models closest to their common trend, and the mean was pulled by models with extreme predictions (Zhu et al. 2021, Ecological Modelling 448, 109502). Zhu et al. recommend PCAm.
  • Disagreement: the standard deviation (sd) and coefficient of variation (cv) of the predictions of the models used, per cell. The printout says how much the models disagree, on how much of the area the SD exceeds 0.1 and 0.2 (preENM defaults for predictions on the 0-1 scale), at which level of the ensemble prediction the disagreement is highest, and which model departs most from the ensemble.
  • Large rasters: terra combines the layers block by block from disk; above 10 million cells every intermediate layer goes to a temporary file, and the block size follows terra::terraOptions(memfrac, memmax). filename writes the result (layers ensemble, sd, cv) to a GeoTIFF.

How much does the ensemble depend on the method? ensemble_scenarios() combines the same models with every method on one sample of cells and gives the mean absolute difference and rank correlation between methods, the suitable share at a threshold, and the AUC at independent points:

es <- ensemble_scenarios(sim$models, sel, threshold = 0.5,
                         presence = test_pres, absence = test_bg)
es
plot_ensemble_scenarios(es)          # each method against the median

22. Thresholds: how much does the mapped range depend on the rule?

A binary map needs a threshold, and the rules for choosing it disagree enough to change the mapped range considerably, so report several together (Hellegers et al. 2025, Diversity and Distributions 31, e70019) or choose the rule by the goal of the study: rules that minimise underprediction (maxTSS, DSS) suit e.g. finding where invasive species may establish, rules that penalise overprediction (MCC, F) suit extinction-risk assessments. thresholds() takes the predictions at presence and at absence/background points (two vectors, or the table of extract_predictions() for several models at once) and gives, for each rule, the threshold, sensitivity, specificity, TSS and the predicted-suitable share (the share of absence/background points at or above the threshold; with background that represents the study area, the share of the area mapped as suitable):

tab <- extract_predictions(models, presence, background)
th <- thresholds(tab)                          # all rules, every model
th                                             # how much the mapped range varies
plot_thresholds(th, file = "thresholds.pdf")
ag <- threshold_agreement(models[["GLM"]], th, model = "GLM")
ag                                             # area suitable under all / most / any rule
terra::writeRaster(ag$count, "GLM_rules_suitable.tif")
Share of the background mapped as suitable under each rule
Share of the background mapped as suitable under each rule
Rule Threshold
maxSSS, maxTSS maximum of sensitivity + specificity (the same criterion under two names; Liu et al. 2013 recommend it for presence-background data)
equal_ss sensitivity equal to specificity (DSS)
maxMCC, maxF maximum of Matthews’ correlation coefficient or of the F-measure; they penalise overprediction and give smaller ranges (in 1671 European plants the median range under maxTSS was 3.6 and 9.2 times that under MCC and F; Hellegers et al. 2025); need true or pseudo-absences
prevalence predicted prevalence equal to the observed one, or to a prevalence you give
fixed_sens keeps at least sensitivity of the presences (default 0.95)
p10 10th percentile of the presence predictions (about a fixed sensitivity of 0.90)
mutation_point the break of Boyce’s predicted-to-expected curve (100 classes) found by threshold regression (BTQR, Yu et al. 2024); needs no absences, usually strict

The printout says how many times larger the area of the most inclusive rule is than that of the least inclusive one. threshold_agreement() counts, for every cell of a prediction raster, the rules that call it suitable: the cells suitable under all rules are the robust core of the range, those suitable under at least one its widest extent. Restrict the set with rules, e.g. thresholds(tab, rules = c("maxSSS", "p10")).

23. Range metrics for conservation assessment

A suitability map is rarely the final product: an assessment needs the measures of the range derived from it, the quantities of the IUCN Red List criterion B (Omar and Elgamal 2021, Kew Bulletin 76, 477-496), usually obtained with ConR (Dauby et al. 2017, Ecology and Evolution 7, 11292-11303) or by hand in a GIS, and the landscape structure of the range (Curd et al. 2023, Global Change Biology 29, 631-647). range_metrics() computes them from the binary maps under every threshold rule:

th <- thresholds(tab, rules = c("maxSSS", "p10", "maxMCC"))
rm <- range_metrics(c(present = ens_now, future = ens_2070), th,
                    threat_km = 10, occurrences = records, occupied = TRUE)
rm                                     # does the rule change the category?
plot_range_metrics(rm, "AOO_km2", file = "aoo.pdf")
write_range_metrics(rm, "range_metrics")
AOO under each threshold rule, present and future
AOO under each threshold rule, present and future
  • EOO: the minimum convex polygon of the suitable cells; AOO: the 2 x 2 km grid cells (IUCN standard) containing suitable area; the number of locations: cells of a grid of the size of one threatening event (threat_km). All three are computed in an equal-area projection (a warning or message says when one is set up), and the grids are placed to give the fewest cells, as ConR does. EOO is never smaller than AOO. The minimum convex polygon spans the gaps of a disjunct or fragmented range and overstates it (Burgman & Fox 2003, Animal Conservation 6, 19-28); eoo_concave = 0.3 adds a concave EOO beside the IUCN one. With occurrences, the EOO of the records themselves (the usual basis of an IUCN assessment) is reported too.
  • Area and landscape structure (Curd et al. 2023): total suitable area, number and sizes of patches, largest patch index, edge density, distance to the nearest other patch and, for continuous input, mean suitability per patch.
  • Threshold sensitivity: AOO and EOO under different rules can cross a Red List threshold, so the printout says when the threshold met depends on the rule rather than on the species. Report the range.
  • Occupied patches (occupied = TRUE): only patches containing a record, since the predicted suitable area is larger than the occupied area.
  • Change between projections, for every metric and rule. Projected changes are uncertain in both directions: over a century of climate and land-use change, models foresaw fewer than a third of the observed extirpations, missed many colonisations and predicted extirpations that had not happened where change was largest (Auffret et al. 2024, Diversity and Distributions 30, e13834).
  • A threshold met is not a listing: criterion B also needs two of the conditions (a) to (c), and an assessment needs evidence on threats that a model cannot give (IUCN 2012). For millions of cells, aggregate the map first (e.g. to 1 km); a noisy map of 4 million cells takes about half a minute per rule.

24. Is a projected change driven by the data or by the study design?

A model projected to another period can predict a decline (or an increase) that has little to do with the species. Think of a scale that shows 2 kg with nothing on it: before trusting a weight, you look at what the empty scale shows. For a projection, the “empty scale” is the same model fitted to points that know nothing about the species, that is random points from the study area. If those models also predict a decline of 30%, then a decline of 30% for your species is what the study design (area, variables, algorithm, scenario) produces by itself. Warren et al. (2021) found exactly this for several common algorithms. This pipeline works with the predictions of any software, in three steps.

1. Draw the random points, as many as you have records. Real records are concentrated where people collect, so the random points should be too; otherwise the test is too easy to pass (Warren et al. 2026):

sets <- null_occurrences(area = env_m, points = occ, method = "bias",
                         weight = effort, n_sets = 99)
for (i in seq_along(sets)) {
  write.csv(sets[[i]], sprintf("null/%s.csv", names(sets)[i]), row.names = FALSE)
}

method = "bias" draws cells in proportion to recording effort (see gbif_effort_rasters()), "uniform" draws them evenly, and "pattern" moves and turns the real point pattern, which keeps its clustering when there is no estimate of effort.

2. Fit and project the models for each set exactly as for the real records (same background, variables and settings), in your software. Save each result as one raster file with the present prediction and one layer per projection.

3. Compare:

tb <- transfer_bias_test(observed = "models/real.tif",
                         null = as.list(list.files("models/null", full.names = TRUE)),
                         region = present_range,     # optional second summary
                         threshold = "p10", points = occ, null_points = sets)
tb
plot_transfer_bias(tb)
terra::plot(tb$maps[[1]])
write.csv(tb$summary, "transfer_bias.csv", row.names = FALSE)

If you model in R, give your own function instead of the files: transfer_bias_test(fit = my_fit, points = occ, null_points = sets), where my_fit(points) returns the predictions. If you have several models of the real records (cross-validation runs, background sets, bootstrap samples of the records), give them all as a list in observed: their mean is compared with the random points, and their own variation enters prob_exceed.

Change predicted from the real records against the change predicted by models of random points

Grey is the change predicted by the models of random points and the line their 95% interval; the dot is the model of the real records, labelled with two numbers explained below. The verdict for each projection is one of four:

Verdict Meaning
design-driven The real model predicts what the random-point models predict, and those agree on the direction. Any species would give this result.
not distinguishable The real model is within the spread of the random-point models, which do not agree on a direction.
design-dominated The real model is outside 95% of the random-point models, but these predict at least half of its change (dominance), or even more. The records change the prediction, but the change itself comes mostly from the design.
data-driven The real model is outside 95% of the random-point models, and they predict less than half of its change, or the opposite direction.

How different, and does it matter? Whether the real model lies inside the grey interval is only the first question. Two numbers answer the rest:

  • SES (standardised effect size) = (observed − mean of random points) / their SD: how far the real model is from the random points, in their standard deviations. Unlike the p-value, which cannot go below 1 / (number of null models + 1) and so cannot tell “just outside” from “far outside”, it keeps growing with the distance and can be compared between projections, metrics and studies. |SES| below about 2 means the real model is among the random ones.
  • design share = change predicted by random points / change predicted by the real model: the part of the predicted change that the study design produces by itself. 0.2 = random points give 20% of the change, the records the rest; 1 = all of it; above 1 (shown as “design alone 1.4x”) random points predict more change than the records, which weaken it; below 0 random points predict the opposite direction.

Read them together. A large SES with a design share near or above 1 (the figure: SES 7, design alone 1.4×) means the records clearly changed the prediction, yet the predicted decline is what the design produces anyway: it is not evidence that this species is vulnerable. A large SES with a small design share means the change comes from the records. In short:

SES design share What the predicted change is
|SES| < 2 any within the random points: design-driven or not distinguishable
large ≥ 0.5 different from random points, but mostly the design
large < 0.5 or negative mostly the records

prob_exceed gives the probability that a model of the real records predicts a change beyond that of a model of random points (0.5 = they overlap completely, 1 = always beyond). With one model of the records it is the share of random-point models it exceeds; with several models of the records (a list in observed), every pair of a real and a random-point model counts, so the variation among the real models is included.

The measures are the mean change of suitability, the share of cells where it falls and, with a threshold, the proportional change of suitable area. The maps show, per cell, the mean and spread of the change across the random-point models: where the mean is far from zero and the spread is small, the direction of the prediction is fixed by the design. A design-driven result is not necessarily wrong (if the whole area becomes unsuitable, every model says so), but it does not come from your records and needs other evidence. Use 99 or more null models for stable intervals.

25. Which source of uncertainty dominates a set of projections?

A realistic set of projections varies at once in climate model (GCM), scenario, algorithm and cross-validation run, and it is hard to see which choice matters most, and where. partition_uncertainty() splits, in every cell, the variance of the projected suitability among these factors, as in an analysis of variance with the factors as main effects (the partitioning used for climate projections by Hawkins and Sutton 2009 and for their ecological consequences by Wilson et al. 2024, Ecological Informatics 80, 102537):

design <- data.frame(layer = names(projections),          # one row per raster
                     gcm = ..., scenario = ..., algorithm = ..., run = ...)
pu <- partition_uncertainty(projections, design, region = alps)
pu                                       # which source dominates, overall and in the region
plot_partition(pu, file = "partition.pdf")
Dominant source of variance and the pooled shares
Dominant source of variance and the pooled shares
  • Shares: the variance explained by each factor divided by the total variance between projections; what the main effects do not explain (interactions, replicate noise) is interactions/residual. They sum to 1 in every cell. The result holds one share map per factor, the total variance and the dominant source of each cell.
  • Pooled shares for the whole area and an optional region (as in transfer_bias_test()): each cell weighted by its variance, so places where the projections agree count little.
  • Balance: with every combination of levels equally often the shares do not depend on the order of the factors; otherwise a warning says that they do (sequential sums of squares).
  • Scenario is a choice, not an error: its share depends on which scenarios are included and is not directly comparable with the share of climate models (Wilson et al. 2024).
  • Large stacks are processed block by block on disk; projections on 0-100 or 0-1000 are rescaled to 0-1.

25.1 Spread due to coordinate error

Fitting one model per replicate of jitter_uncertainty() (section 6 above) gives predictions that differ only in where the records were placed. coordinate_spread() returns their per-cell mean, standard deviation and coefficient of variation, computed as the disagreement layer of ensemble_models(), so the two are directly comparable: with ensemble, it says in which share of cells coordinate error moves the predictions more than the choice of model.

cs <- coordinate_spread("predictions/jittered", ensemble = ens)
cs                                       # IN SHORT: how much, and compared with the models
plot_coordinate_spread(cs, file = "coordinate_spread.pdf")
Mean prediction and spread due to coordinate error
Mean prediction and spread due to coordinate error

26. Where are the data too sparse to trust a prediction?

Where few records of any species have been made, the absence of records of your species says little, and a prediction there rests on extrapolation. Maps of biogeographical ignorance show this next to the prediction (Tessarolo et al. 2021, Ecography 44, 1743-1755). ignorance_map() turns a recording-effort raster (e.g. from gbif_effort_rasters(), section 9) into an ignorance score from 0 (well recorded) to 1 (nothing recorded), and annotates a suitability raster with it:

eff <- gbif_effort_rasters("effort_table.csv", extent)
ig <- ignorance_map(eff, half = 10, radius_km = 50, suitability = ens$raster[["ensemble"]])
ig                                        # share of the suitable area that is poorly known
plot_ignorance(ig, file = "ignorance.pdf")
terra::writeRaster(ig$raster, "ignorance.tif")
Ignorance and the joint map of suitability and ignorance
Ignorance and the joint map of suitability and ignorance
  • Scores (Ruete 2015, Biodiversity Data Journal 3, e5361): "half" (default), I = O / (N + O) with O (half) the effort that halves ignorance, independent of the most recorded cell; "log" and "linear", relative to the most recorded cell. index = TRUE uses records per species, less inflated by a few very common species.
  • radius_km lets effort count for the neighbouring cells within that distance (information decays with distance; the range from suggest_block_size() is a natural choice).
  • With suitability, the result adds the suitability where ignorance is low (suitability_known) and four classes: suitable or not, known or ignorant. From the records themselves. With a records table (e.g. a GBIF download of the reference group), record_ignorance() follows the components of Tessarolo et al. more closely. Each record’s quality combines the completeness of its cell’s inventory (1 - f1 / N, the expected final slope of the species accumulation curve; cells with fewer than min_records records count as incomplete), its age (year; a Gaussian decay, half at half_life years), optionally its taxonomic reliability (a 0-1 value per record, e.g. 1 / 0.9 / 0.75 for taxonomist / expert / amateur identifiers, as in Tessarolo et al.) and the precision of its coordinates (coordinateUncertaintyInMeters, an addition). A cell takes its best record of the focal species, or the mean over the other species; empty cells are interpolated within radius_km.
ig <- record_ignorance("gbif_group_download.csv", grid_10km,
                       species = "Focal species", radius_km = 100,
                       reliability = c(PRESERVED_SPECIMEN = 1,
                                       HUMAN_OBSERVATION = 0.9),
                       reliability_col = "basisOfRecord",   # your choice
                       suitability = ens$raster[["ensemble"]])

Taxonomic reliability has no standard proxy in GBIF data: identifier classes need expert coding. As an option, taxon_complexity() derives one weight per species from the number of its synonyms and of its subspecies and varieties in World Flora Online (via the WorldFlora package) or another Darwin Core backbone: 1 / (1 + log(1 + n)), a preENM default rather than a published weighting (difficult groups have many synonyms, but well-studied ones too):

library(WorldFlora)
WFO.download(); WFO.remember()           # the WFO backbone, once
tc <- taxon_complexity(unique(gbif$species), WFO.data)
ig <- record_ignorance(gbif, grid_10km, species = "Focal species",
                       reliability = tc, env = predictors)

With env, empty cells are interpolated with the spatio-environmental distance of Tessarolo et al. (geographic and environmental distances, each rescaled to 0-1, combined as space^0.5 x environment^0.5), so records from similar environments inform an empty cell more; cells with records of the focal species carry half of the weight, as in Tessarolo et al.