dismo (version 1.1-1)

mess: Multivariate environmental similarity surfaces (MESS)

Description

Compute multivariate environmental similarity surfaces (MESS), as described by Elith et al., 2010

Usage

mess(x, v, full=FALSE, filename='', ...)

Arguments

x
Raster* object
v
matrix or data.frame containing the reference values. Each column should correspond to one layer of the Raster* object
full
logical. If FALSE a RasterLayer with the MESS values is returned. If TRUE, a RasterBrick is returned with n layers corresponding to the layers of the input Raster object and an additional layer with the MESS values
filename
character. Output filename (optional)
...
additional arguments as for writeRaster

Value

A RasterBrick with layers corresponding to the input layers and an additional layer with the mess values (if full=TRUE and nlayers(x) > 1) or a RasterLayer with the MESS values (if full=FALSE).

Details

v can be obtained for a set of points using extract .

References

Elith J., M. Kearney M., and S. Phillips, 2010. The art of modelling range-shifting species. Methods in Ecology and Evolution 1:330-342.

Examples

Run this code

set.seed(9)
r <- raster(ncol=10, nrow=10)
r1 <- setValues(r, (1:ncell(r))/10 + rnorm(ncell(r)))
r2 <- setValues(r, (1:ncell(r))/10 + rnorm(ncell(r)))
r3 <- setValues(r, (1:ncell(r))/10 + rnorm(ncell(r)))
s <- stack(r1,r2,r3)
names(s) <- c('a', 'b', 'c')
xy <- cbind(rep(c(10,30,50), 3), rep(c(10,30,50), each=3))
refpt <- extract(s, xy)

ms <- mess(s, refpt, full=TRUE)
plot(ms)


## Not run: 
# filename <- paste(system.file(package="dismo"), '/ex/bradypus.csv', sep='')
# bradypus <- read.table(filename, header=TRUE, sep=',')
# bradypus <- bradypus[,2:3]
# files <- list.files(path=paste(system.file(package="dismo"),'/ex', sep=''), 
#    pattern='grd', full.names=TRUE )
# predictors <- stack(files)
# predictors <- dropLayer(x=predictors,i=9)
# reference_points <- extract(predictors, bradypus)
# mss <- mess(x=predictors, v=reference_points, full=TRUE)
# plot(mss)
# ## End(Not run)

Run the code above in your browser using DataCamp Workspace