mess: Multivariate environmental similarity surfaces (MESS)

messR Documentation

Multivariate environmental similarity surfaces (MESS)

Description

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

Usage

## S4 method for signature 'SpatRaster'
mess(x, v, full=FALSE, filename="", ...)

## S4 method for signature 'data.frame'
mess(x, v, full=FALSE)

Arguments

x

SpatRaster or data.frame

v

matrix or data.frame containing the reference values; each column should correspond to one layer of the SpatRaster object. If x is a SpatRaster, it can also be a SpatVector with reference locations (points)

full

logical. If FALSE a SpatRaster with the MESS values is returned. If TRUE, a SpatRaster is returned with n layers corresponding to the layers of the input SpatRaster and an additional layer with the MESS values

filename

character. Output filename (optional)

...

additional arguments as for writeRaster

Details

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

Value

SpatRaster (or data.frame) with layers (columns) corresponding to the input layers and an additional layer with the mess values (if full=TRUE and nlyr(x) > 1) or a SpatRaster (data.frame) with the MESS values (if full=FALSE).

Author(s)

Jean-Pierre Rossi, Robert Hijmans, Paulo van Breugel

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.2041-210X.2010.00036.x")}

Examples


set.seed(9)
r <- rast(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 <- c(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 <- paste0(system.file(package="predicts"), "/ex/bradypus.csv")
bradypus <- read.table(filename, header=TRUE, sep=',')
bradypus <- bradypus[,2:3]

predfile <- paste0(system.file(package="predicts"), "/ex/bio.tif")
predictors <- rast(predfile)
reference_points <- extract(predictors, bradypus, ID=FALSE)
mss <- mess(x=predictors, v=reference_points, full=TRUE)

breaks <- c(-500, -50, -25, -5, 0, 5, 25, 50, 100)
fcol <- colorRampPalette(c("blue", "beige", "red"))
plot(mss[[10]], breaks=breaks, col=fcol(9), plg=list(x="bottomleft"))

## End(Not run)


rspatial/predicts documentation built on July 11, 2024, 4:35 p.m.