Learn R Programming

dismo (version 0.7-23)

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=TRUE)

Arguments

x
A Raster* object
v
A data frame containing the reference values. Each column should correspond to one layer of the RasterStack object.
full
If full=TRUE mess returns a RasterStack object with n layers corresponding to the index for each individual layer of the input RasterStack and an additioanl layer with the MESS values. If full=FALSE mess

Value

  • Either a RasterStack object with n layers corresponding to the values for each individual layer of the input RasterStack and an additional layer with the mess values (if full=TRUE) or a single Raster object with the MESS values (if full=FALSE).

Details

v can be produced using function extract .

References

Elith J., M. Kearney M., and S. Phillips, 2010. The art of modelling range-shifting species. http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2010.00036.x/abstract{Methods in Ecology and Evolution 1:330-342}.

Examples

Run this code
r1 <- raster(ncol=10, nrow=10) ; r1[] <- (1:ncell(r1))/10 + rnorm(ncell(r1))
r2 <- raster(ncol=10, nrow=10) ; r2[] <- (1:ncell(r1))/10 + rnorm(ncell(r2))
r3 <- raster(ncol=10, nrow=10) ; r3[] <- (1:ncell(r1))/10 + rnorm(ncell(r3))

rasters <- stack(r1,r2,r3)
plot(rasters)
xy <- expand.grid(c(10,30,50),c(10,30,50))
#plot(r1); points(xy)
refpt <- extract(rasters,xy)
mess <- mess(x=rasters, v=refpt, full=TRUE)
plot(mess)


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)
mess.out <- mess(x=predictors, v=reference_points, full=TRUE)
plot(mess.out)

Run the code above in your browser using DataLab