The MESS is calculated as described in Elith et al. (2010). MESS represents
how similar a point in a testing fold is to a training fold (as a reference
set of points), with respect to a set of predictor variables in r.
The negative values are the sites where at least one variable has a value that is outside
the range of environments over the reference set, so these are novel environments.
When using the L1 (Manhattan) or L2 (Euclidean) score options (experimental), the
function performs the following steps for each test sample:
1. Calculates the minimum distance between each test sample and all training samples
in the same fold using the selected metric (L1 or L2).
2. Calculates a baseline distance: the average of the minimum distances between a set
of random background samples (defined by num_sample) from the raster and all training/test
samples combined.
3. Computes a similarity score by subtracting the test sample’s minimum distance from
the baseline average. A higher score indicates the test sample is more similar to
the training data, while lower or negative scores indicate novelty.
This provides a simple, distance-based similarity score, not a raw distance: values
below zero indicate test samples that are farther from their training data than the
random-background baseline. Note that this approach is experimental.
When the supplied cv object was built with presence_bg = TRUE, the similarity
is computed on the presences only: the background points (locations sampled to represent
the available conditions rather than confirmed absences) are excluded from both the training and
testing sets of every fold, matching the framing used in cv_distance. This is read
automatically from cv.