BIOMOD_RangeSize {biomod2} | R Documentation |
Analyze the range size differences between projections of species distribution models
Description
This function allows to calculate the absolute number of locations (pixels) lost, stable and gained, as well as the corresponding relative proportions, between two (or more) binary projections of (ensemble) species distribution models (which can represent new time scales or environmental scenarios for example).
Usage
BIOMOD_RangeSize(proj.current, proj.future)
## S4 method for signature 'data.frame,data.frame'
BIOMOD_RangeSize(proj.current, proj.future)
## S4 method for signature 'SpatRaster,SpatRaster'
BIOMOD_RangeSize(proj.current, proj.future)
Arguments
proj.current |
a |
proj.future |
a |
Details
Note that this function is only relevant to compare binary projections, made on the
same area with the same resolution.
Comparison between proj.current
and proj.future
depends
on the number of projection in both objects:
proj.current | proj.future | Comparison |
1 projection (e.g. data.frame with 1 column, SpatRaster with 1 layer) | 1 projection (e.g. data.frame with 1 column, SpatRaster with 1 layer) | comparison of both projection (e.g. current vs future conditions for the same model ; current vs current condition for two different models) |
n projections (e.g. data.frame with n column, SpatRaster with n layer) | n projections (e.g. data.frame with n column, SpatRaster with n layer) | comparing projection i in proj.current to projection i in proj.future (e.g. comparing current vs future condition for n models) |
1 projection (e.g. data.frame with 1 column, SpatRaster with 1 layer) | n projections (e.g. data.frame with n column, SpatRaster with n layer) | comparing projection in proj.current to each projection in proj.future (e.g. comparing current vs n different future condition (e.g. climate change scenario) for 1 model) |
Diff.By.Pixel
object is obtained by applying the simple following formula :
proj.future - 2 * proj.current
Value
A list
containing two objects :
- Compt.By.Species
a
data.frame
containing the summary of range change for each comparison-
Loss
: number of pixels predicted to be lost -
Stable0
: number of pixels not currently occupied and not predicted to be -
Stable1
: number of pixels currently occupied and predicted to remain occupied -
Gain
: number of pixels predicted to be gained -
PercLoss
: percentage of pixels currently occupied and predicted to be lost (Loss / (Loss + Stable1)
) -
PercGain
: percentage of pixels predicted to be gained compare to the number of pixels currently occupied (Gain / (Loss + Stable1)
) -
SpeciesRangeChange
: percentage of pixels predicted to change (loss or gain) compare to the number of pixels currently occupied (PercGain - PercLoss
) -
CurrentRangeSize
: number of pixels currently occupied -
FutureRangeSize0Disp
: number of pixels predicted to be occupied, assuming no migration -
FutureRangeSize1Disp
: number of pixels predicted to be occupied, assuming migration
-
- Diff.By.Pixel
an object in the same form than the input data (
proj.current
andproj.future
) and containing a value for each point/pixel of each comparison among :-
-2
: predicted to be lost -
-1
: predicted to remain occupied -
0
: predicted to remain unoccupied -
1
: predicted to be gained
-
Author(s)
Wilfried Thuiller, Damien Georges, Bruno Lafourcade
See Also
BIOMOD_Projection
, BIOMOD_EnsembleForecasting
,
bm_PlotRangeSize
Other Main functions:
BIOMOD_EnsembleForecasting()
,
BIOMOD_EnsembleModeling()
,
BIOMOD_FormatingData()
,
BIOMOD_LoadModels()
,
BIOMOD_Modeling()
,
BIOMOD_Projection()
Examples
library(terra)
# Load species occurrences (6 species available)
data(DataSpecies)
head(DataSpecies)
# Select the name of the studied species
myRespName <- 'GuloGulo'
# Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])
# Get corresponding XY coordinates
myRespXY <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]
# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_current)
myExpl <- terra::rast(bioclim_current)
# --------------------------------------------------------------- #
file.out <- paste0(myRespName, "/", myRespName, ".AllModels.models.out")
if (file.exists(file.out)) {
myBiomodModelOut <- get(load(file.out))
} else {
# Format Data with true absences
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespXY,
resp.name = myRespName)
# Model single models
myBiomodModelOut <- BIOMOD_Modeling(bm.format = myBiomodData,
modeling.id = 'AllModels',
models = c('RF', 'GLM'),
CV.strategy = 'random',
CV.nb.rep = 2,
CV.perc = 0.8,
OPT.strategy = 'bigboss',
metric.eval = c('TSS','ROC'),
var.import = 3,
seed.val = 42)
}
models.proj <- get_built_models(myBiomodModelOut, algo = "RF")
# Project single models
myBiomodProj <- BIOMOD_Projection(bm.mod = myBiomodModelOut,
proj.name = 'CurrentRangeSize',
new.env = myExpl,
models.chosen = models.proj,
metric.binary = 'all',
build.clamping.mask = TRUE)
# --------------------------------------------------------------- #
# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_future)
myExplFuture <- terra::rast(bioclim_future)
# Project onto future conditions
myBiomodProjectionFuture <- BIOMOD_Projection(bm.mod = myBiomodModelOut,
proj.name = 'FutureRangeSize',
new.env = myExplFuture,
models.chosen = models.proj,
metric.binary = 'TSS')
# Load current and future binary projections
CurrentProj <- get_predictions(myBiomodProj,
metric.binary = "TSS",
model.as.col = TRUE)
FutureProj <- get_predictions(myBiomodProjectionFuture,
metric.binary = "TSS",
model.as.col = TRUE)
# Compute differences
myBiomodRangeSize <- BIOMOD_RangeSize(proj.current = CurrentProj, proj.future = FutureProj)
myBiomodRangeSize$Compt.By.Models
plot(myBiomodRangeSize$Diff.By.Pixel)
# Represent main results
bm_PlotRangeSize(bm.range = myBiomodRangeSize)