MESS3D {voluModel} | R Documentation |
Calculate MESS
Description
Calculates multivariate environmental similarity surface based on model calibration and projection data
Usage
MESS3D(calibration, projection)
Arguments
calibration |
A |
projection |
A named |
Details
MESS3D
is a wrapper around MESS
from the modEvA
package. It calculates MESS for each depth layer. Negative values
indicate areas of extrapolation which should be interpreted with
caution (see Elith et al, 2010 in MEE).
Value
A SpatRaster
vector with MESS scores for each
voxel; layer names correspond to layer names of first
SpatRaster
vector in projection
list
.
Note
The calibration dataset should include both presences and background/pseudoabsence points used to calibrate an ecological niche model.
References
Elith J, Kearney M, and Phillips S. 2010. The art of modelling range-shifting species. Methods in Ecology and Evolution, 1, 330-342.
See Also
Examples
library(terra)
library(dplyr)
# Create sample rasterBricks
r1 <- rast(ncol=10, nrow=10)
values(r1) <- 1:100
r2 <- rast(ncol=10, nrow=10)
values(r2) <- c(rep(20, times = 50), rep(60, times = 50))
r3 <- rast(ncol=10, nrow=10)
values(r3) <- 8
envBrick1 <- c(r1, r2, r3)
names(envBrick1) <- c(0, 10, 30)
r1 <- rast(ncol=10, nrow=10)
values(r1) <- 100:1
r2 <- rast(ncol=10, nrow=10)
values(r2) <- c(rep(10, times = 50), rep(20, times = 50))
r3 <- rast(ncol=10, nrow=10)
values(r3) <- c(rep(c(10,20,30,25), times = 25))
envBrick2 <- c(r1, r2, r3)
names(envBrick2) <- c(0, 10, 30)
rastList <- list("temperature" = envBrick1, "salinity" = envBrick2)
# Create test reference set
set.seed(0)
longitude <- sample(ext(envBrick1)[1]:ext(envBrick1)[2],
size = 10, replace = FALSE)
set.seed(0)
latitude <- sample(ext(envBrick1)[3]:ext(envBrick1)[4],
size = 10, replace = FALSE)
set.seed(0)
depth <- sample(0:35, size = 10, replace = TRUE)
occurrences <- as.data.frame(cbind(longitude,latitude,depth))
# Calibration
calibration <- lapply(rastList, FUN = function(x) xyzSample(occurrences, x)) %>% bind_rows
# Run the function
messStack <- MESS3D(calibration = calibration, projection = rastList)
plot(messStack)