similarity {ENMeval}R Documentation

Calculate Multivariate Environmental Similarity

Description

NOTICE: This function was borrowed from the rmaxent package written by John Baumgartner (https://github.com/johnbaums/rmaxent/).

Calculate Multivariate Environmental Similarity and most dissimilar/similar variables with respect to a reference dataset, for a set of environmental variables.

Usage

similarity(x, ref, full = FALSE)

Arguments

x

a 'Raster*', 'list', 'matrix', or 'data.frame' where each layer/column/element represents focal values of an environmental variable.

ref

a 'list', 'matrix', or 'data.frame' where each column/element represents reference values for an environmental variable (corresponding to those given in 'x').

full

(logical) should similarity values be returned for all variables? If 'FALSE' (the default), then only the minimum similarity scores across variables will be returned.

Details

'similarity' uses the MESS algorithm described in Appendix S3 of Elith et al. 2010.

Value

If 'x' is a 'Raster*' object, this function returns a list containing: - 'similarity': a 'RasterStack' giving the environmental similarities for each variable in 'x' (only included when 'full=TRUE'); - 'similarity_min': a 'Raster' layer giving the minimum similarity value across all variables for each location (i.e. the MESS); - 'mod': a factor 'Raster' layer indicating which variable was most dissimilar to its reference range (i.e. the MoD map, Elith et al. 2010); and - 'mos': a factor 'Raster' layer indicating which variable was most similar to its reference range.

If 'x' is a 'list', 'matrix', or 'data.frame', the function will return a list as above, but with 'RasterStack' and 'Raster' objects replaced by matrix and vectors.

References

Elith, J., Kearney, M., and Phillips, S. (2010) The art of modelling range-shifting species. Methods in Ecology and Evolution, 1: 330-342. doi: 10.1111/j.2041-210X.2010.00036.x

Examples

library(dismo)
library(raster)
ff <- list.files(system.file('ex', package='dismo'), '\\.grd$', 
                 full.names=TRUE )
predictors <- stack(grep('biome', ff, value=TRUE, invert=TRUE))
occ <- read.csv(system.file('ex/bradypus.csv', package='dismo'))[, -1]
ref <- extract(predictors, occ)
mess <- similarity(predictors, ref, full=TRUE)

## Not run: 
library(rasterVis)
library(RColorBrewer)
levelplot(mess$mod, col.regions=brewer.pal(8, 'Set1'))
levelplot(mess$mos, col.regions=brewer.pal(8, 'Set1'))

## End(Not run)

[Package ENMeval version 2.0.1 Index]