Calculate environmental similarity of reference datasets to predictors.
Source:R/similarity.R
similarity.Rd
Calculate the environmental similarity of the provided covariates with respect to a reference dataset. Currently supported is Multivariate Environmental Similarity index and the multivariate combination novelty index (NT2) based on the Mahalanobis divergence (see references).
Usage
similarity(
obj,
ref,
ref_type = "poipo",
method = "mess",
predictor_names = NULL,
full = FALSE,
plot = TRUE,
...
)
# S4 method for BiodiversityDistribution,character,character,character,logical,logical
similarity(obj,ref_type,method,predictor_names,full,plot,...)
# S4 method for SpatRaster,sf,character,logical,logical
similarity(obj,ref,method,full,plot,...)
Arguments
- obj
A
BiodiversityDistribution
,DistributionModel
or alternatively aSpatRaster
object.- ref
A
BiodiversityDistribution
,DistributionModel
or alternatively adata.frame
with extracted values (corresponding to those given inobj
).- ref_type
A
character
specifying the type of biodiversity to use when obj is aBiodiversityDistribution
.- method
A specifc method for similarity calculation. Currently supported:
'mess'
,'nt'
.- predictor_names
An optional
character
specifying the covariates to be used (Default:NULL
).- full
should similarity values be returned for all variables (Default:
FALSE
)?- plot
Should the result be plotted? Otherwise return the output list (Default:
TRUE
).- ...
other options (Non specified).
Value
This function returns a list containing:
similarity
: ASpatRaster
object with multiple layers giving the environmental similarities for each variable inx
(only included when"full=TRUE"
);mis
: aSpatRaster
layer giving the minimum similarity value across all variables for each location (i.e. the MESS);exip
: aSpatRaster
layer indicating whether any model would interpolate or extrapolate to this location based on environmental surface;mod
: a factorSpatRaster
layer indicating which variable was most dissimilar to its reference range (i.e. the MoD map, Elith et al. 2010); andmos
: a factorSpatRaster
layer indicating which variable was most similar to its reference range.
Details
similarity
implements the MESS algorithm described in Appendix
S3 of Elith et al. (2010) as well as the Mahalanobis dissimilarity
described in Mesgaran et al. (2014).
References
Elith, J., Kearney, M., and Phillips, S. (2010) "The art of modelling range-shifting species" https://doi.org/10.1111/j.2041-210X.2010.00036.x Methods in Ecology and Evolution, 1: 330-342
Mesgaran, M.B., Cousens, R.D. and Webber, B.L. (2014) "Here be dragons: a tool for quantifying novelty due to covariate range and correlation change when projecting species distribution models" https://doi.org/10.1111/ddi.12209 Diversity and Distributions, 20: 1147-1159.
Examples
if (FALSE) {
plot(
similarity(x) # Where x is a distribution or Raster object
)
}