Skip to contents

Models projected to another time (or place) can predict a decline or an increase of suitable conditions that has little to do with the species. The set of environments available in the study area shifts between the periods, every algorithm reacts to that shift in its own way, and the result can be nearly the same whatever points the model is fitted to. Warren et al. (2021) showed this by fitting the same models to random points: the "effect of climate change" on a species was reproduced by models that knew nothing about it.

Usage

transfer_bias_test(
  observed = NULL,
  null = NULL,
  fit = NULL,
  points = NULL,
  null_points = NULL,
  baseline = 1,
  region = NULL,
  threshold = NULL,
  dominance = 0.5,
  maps = TRUE,
  coords = NULL,
  points_crs = "EPSG:4326",
  verbose = TRUE,
  rescale = TRUE
)

Arguments

observed

Predictions of the model fitted to the real records: a terra::SpatRaster or file(s) with the present prediction and one layer per projection (other period, scenario or region on the same grid). Or a list of such rasters, one per model of the real records (e.g. cross-validation runs): their mean is the observed value, and prob_exceed includes their variation.

null

Predictions of the null models: a list of rasters (or of file paths) with the same layers as observed, one element per null set.

fit

Instead of observed and null: a function that takes a data.frame of points (x, y) and returns the predictions as described for observed.

points

The real records, for fit and for threshold = "p10".

null_points

The null sets from null_occurrences(), for fit and for threshold = "p10".

baseline

The layer with the present prediction (name or number).

region

Optional part of the area for a second set of summaries: polygons (sf, SpatVector) or a raster (cells that are not NA and not 0).

threshold

Optional threshold of suitability for area_change: a number, or "p10" for the 10th percentile of the present prediction at the points each model was fitted to (needs points and null_points).

dominance

Smallest design_share at which a result outside the null interval is called "design-dominated" instead of "data-driven" (default 0.5: random points reproduce at least half of the change).

maps

Also return the maps.

coords, points_crs

Coordinate columns and CRS of points.

verbose

Show progress when fit is run.

rescale

Bring every set of predictions (observed and null) to the 0-1 scale: predictions on 0-100 or 0-1000 are divided by 100 or 1000, with a message; see extract_predictions().

Value

A list of class transfer_bias with summary (one row per projection, scope and metric: observed, null_mean, null_sd, null_lo and null_hi (95% interval), null_agreement (share of null models with the direction of the null mean), signal (observed - null_mean), ses, design_share, prob_exceed, percentile (share of null values below the observed one), p_value (two-sided) and verdict), null (the values of every null model), observed (the values of every model of the records), maps, n_null and n_observed.

Details

The test repeats their procedure for your study. Fit the same models (same area, background, variables, algorithm and settings) to sets of null points from null_occurrences(), project them to the same scenarios, and give the predictions here. The function measures the predicted change in each null model and places the change predicted from the real records within that distribution. The verdict has four classes:

  • design-driven: the real model predicts what the random-point models predict, and those agree on the direction. The same result would have come out for any species; it says nothing about this one.

  • 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 agree on the direction and reproduce at least dominance (default half) of the observed change. The records change the prediction, but most of the predicted change comes from the design. This includes the case in which random points predict a larger change than the records (design_share > 1): the records weaken it, and the predicted change itself is not evidence about the species.

  • data-driven: the real model is outside 95% of the random-point models, and these reproduce less than dominance of its change (or point the other way, or do not agree on a direction).

How large is the difference? Whether the real model lies inside the null interval is only the first question. Three numbers measure how far it is and what it means:

  • ses, the standardised effect size, (observed - null mean) / null SD (Gotelli and McCabe 2002): how many standard deviations of the random-point models separate them from the real model. Unlike the p-value, which cannot go below 1 / (number of null models + 1), it keeps growing with the distance, and it can be compared between projections, metrics and studies. |SES| < 2 is roughly within the range of random points; the interval and the p-value are exact, the SES assumes a roughly symmetric distribution of the null values.

  • design_share, (null mean - no change) / (observed - no change): the part of the predicted change that random points reproduce. 0 = none of it, 1 = all of it, 0.8 = random points alone give 80% of the decline; above 1 the records weaken the change the design produces, below 0 the design points the other way. A result can be clearly different from random points (large SES) and still be mostly design (design share near 1): "significant" is not the same as "driven by the records".

  • prob_exceed: the probability that a model of the real records predicts a change beyond that of a model of random points, in the direction of the difference. Give several models of the real records in observed (e.g. the cross-validation runs or models of bootstrap samples of the records) to include their own variation: it is then the share of all pairs of a real and a random-point model in which the real one is further (the common-language effect size of McGraw and Wong 1992; 0.5 = the two overlap completely, 1 = every real model is beyond every random-point model). With one model it is the share of random-point models it exceeds.

The null models are estimates of how the study design behaves, not a hypothesis that must be rejected before a model may be used: a design-driven prediction can still be right (if the whole area becomes unsuitable, every model will say so). But a result that is the same for any data needs other lines of evidence (Warren et al. 2021).

The measures of change, for the whole predicted area and, with region, for a part of it (e.g. the present range): mean_change (mean of projected minus present suitability), share_declining (share of cells where suitability falls) and, with a threshold, area_change (proportional change of the area at or above the threshold: -0.5 = half is lost, 1 = doubled).

With maps = TRUE the result also has maps per projection: the mean and the standard deviation of the change across the null models, and the observed change minus the null mean. Where the null mean is far from zero and the standard deviation small, the direction of the prediction is fixed by the design and the data have little leverage (Warren et al. 2021, Fig. 7).

preENM does not fit models. Either give the predictions (observed, null), made with any software, or give your own function fit that fits and projects a model, and it is run for the real records and every null set.

Status and limits. The test of Warren et al. (2021); the summaries are preENM's. The null models must be fitted exactly like the real ones, and the number of null sets limits the precision of the result.

References

Gotelli, N.J., McCabe, D.J. (2002) Species co-occurrence: a meta-analysis of J. M. Diamond's assembly rules model. Ecology 83, 2091-2096.

McGraw, K.O., Wong, S.P. (1992) A common language effect size statistic. Psychological Bulletin 111, 361-365.

Warren, D.L., Dornburg, A., Zapfe, K., Iglesias, T.L. (2021) The effects of climate change on Australia's only endemic Pokemon: measuring bias in species distribution models. Methods in Ecology and Evolution 12, 985-995. doi:10.1111/2041-210X.13591

Warren, D.L., Casadei-Ferreira, A., Economo, E.P., Dinnage, R., Kass, J.M. (2026) Incorporating sampling bias into ENM/SDM permutation tests: new methods and a case study on neotropical ants. Ecography 2026, e08559. doi:10.1002/ecog.08559

Examples

sim <- simulate_enm_data(seed = 1)
present <- sim$env
future <- sim$env + 0.15              # everything shifts
names(future) <- names(present)
# your own model: here a simple climate envelope (range of the records)
fit <- function(p) {
  e <- terra::extract(present, as.matrix(p[, c("x", "y")]))
  lim <- apply(e, 2, range, na.rm = TRUE)
  inside <- function(r) {
    out <- (r[[1]] >= lim[1, 1]) * (r[[1]] <= lim[2, 1]) *
      (r[[2]] >= lim[1, 2]) * (r[[2]] <= lim[2, 2])
    out
  }
  out <- c(inside(present), inside(future))
  names(out) <- c("present", "future")
  out
}
sets <- null_occurrences(present, sim$presence, n_sets = 19)
tb <- transfer_bias_test(fit = fit, points = sim$presence,
                         null_points = sets, verbose = FALSE)
tb
#> Design bias of projected change (19 null models, present = present)
#> 
#>  projection          metric observed null_mean null_lo null_hi   ses
#>      future     mean_change   -0.198    -0.276  -0.288  -0.256  8.22
#>      future share_declining    0.262     0.282   0.274   0.295 -2.82
#>  design_share p_value          verdict
#>         1.390    0.05 design-dominated
#>         0.915    0.05 design-dominated
#> 
#> IN SHORT (mean change of suitability)
#> - future: random points alone predict a decline of -0.276, larger than that
#>     of the real model (-0.198; SES = 8.2). The records weaken the change; the
#>     predicted decline itself comes from the design, not from this species.
#> 
#> SES: distance from the random-point models in their SDs. design share: part of
#> the change that random points reproduce (1 = all of it).
#> Fewer than 99 null models: the intervals are rough.
#> 
#> A preENM sensitivity analysis: how much the result depends on the study
#> design rather than the records. The others are listed in
#> ?sensitivity_analyses.