bm_PseudoAbsences {biomod2} | R Documentation |
Select pseudo-absences
Description
This internal biomod2 function allows to select pseudo-absences according
to 4 different methods : random
, sre
, disk
or user.defined
(see Details).
Usage
bm_PseudoAbsences(
resp.var,
expl.var,
nb.rep = 1,
strategy = "random",
nb.absences = NULL,
sre.quant = 0,
dist.min = 0,
dist.max = NULL,
user.table = NULL
)
bm_PseudoAbsences_user.defined(resp.var, expl.var, ...)
## S4 method for signature 'ANY,SpatVector'
bm_PseudoAbsences_user.defined(resp.var, expl.var, user.table)
## S4 method for signature 'ANY,SpatRaster'
bm_PseudoAbsences_user.defined(resp.var, expl.var, user.table)
bm_PseudoAbsences_random(resp.var, expl.var, ...)
## S4 method for signature 'ANY,SpatVector'
bm_PseudoAbsences_random(resp.var, expl.var, nb.absences, nb.rep)
## S4 method for signature 'ANY,SpatRaster'
bm_PseudoAbsences_random(resp.var, expl.var, nb.absences, nb.rep)
bm_PseudoAbsences_sre(resp.var, expl.var, ...)
## S4 method for signature 'ANY,SpatVector'
bm_PseudoAbsences_sre(resp.var, expl.var, sre.quant, nb.absences, nb.rep)
## S4 method for signature 'ANY,SpatRaster'
bm_PseudoAbsences_sre(resp.var, expl.var, sre.quant, nb.absences, nb.rep)
bm_PseudoAbsences_disk(resp.var, expl.var, ...)
## S4 method for signature 'ANY,SpatVector'
bm_PseudoAbsences_disk(
resp.var,
expl.var,
dist.min,
dist.max,
nb.absences,
nb.rep
)
## S4 method for signature 'ANY,SpatRaster'
bm_PseudoAbsences_disk(
resp.var,
expl.var,
dist.min,
dist.max,
nb.absences,
nb.rep
)
Arguments
resp.var |
a |
expl.var |
a |
nb.rep |
an |
strategy |
a |
nb.absences |
(optional, default |
sre.quant |
(optional, default |
dist.min |
(optional, default |
dist.max |
(optional, default |
user.table |
(optional, default |
... |
(optional, one or several of the above arguments depending on the selected method) |
Details
Concerning random selection :
The idea is to select pseudo-absences randomly in spatial locations where the species has not
been sampled. This method is the simplest one and the most appropriate if lacking information
about the presence sampling (non-exhaustive, biased sampling, etc).
Concerning SRE selection (see bm_SRE
) :
The idea is to select pseudo-absences in spatial locations whose environmental conditions are
different from those of the presence points. This method is appropriate when most of the
environmental space of the species has been sampled.
Concerning disk selection :
The idea is to select pseudo-absences, not too close from presence points, but not too far
away either. This method is appropriate when most of the spatial range of the species has
been sampled.
Concerning user defined selection :
The user can provide pseudo-absences locations through a table containing spatial locations
in rows, pseudo-absences repetitions in columns, and TRUE/FALSE
values indicating
whether each point is to be considered as pseudo-absence or not for each dataset.
Value
A list
containing the following elements :
-
xy
: the coordinates of the species observations -
sp
: the values of the species observations (0
,1
orNA
) -
env
: the explanatory variables -
pa.tab
: the corresponding table of selected pseudo-absences (indicated byTRUE
orFALSE
)
Author(s)
Wilfried Thuiller, Damien Georges
See Also
bm_SRE
, BIOMOD.formated.data.PA
,
BIOMOD_FormatingData
Other Secundary functions:
bm_BinaryTransformation()
,
bm_CrossValidation()
,
bm_FindOptimStat()
,
bm_MakeFormula()
,
bm_ModelingOptions()
,
bm_PlotEvalBoxplot()
,
bm_PlotEvalMean()
,
bm_PlotRangeSize()
,
bm_PlotResponseCurves()
,
bm_PlotVarImpBoxplot()
,
bm_RunModelsLoop()
,
bm_SRE()
,
bm_SampleBinaryVector()
,
bm_SampleFactorLevels()
,
bm_Tuning()
,
bm_VariablesImportance()
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)
# --------------------------------------------------------------- #
# Create the different pseudo-absence datasets
# Transform true absences into potential pseudo-absences
myResp.PA <- ifelse(myResp == 1, 1, NA)
myResp.PA.vect <- vect(cbind(myRespXY, myResp.PA), geom = c("X_WGS84","Y_WGS84"))
# random method
PA.r <- bm_PseudoAbsences(resp.var = myResp.PA.vect,
expl.var = myExpl,
nb.rep = 4,
nb.absences = 1000,
strategy = 'random')
# disk method
PA.d <- bm_PseudoAbsences(resp.var = myResp.PA.vect,
expl.var = myExpl,
nb.rep = 4,
nb.absences = 500,
strategy = 'disk',
dist.min = 5,
dist.max = 35)
# SRE method
PA.s <- bm_PseudoAbsences(resp.var = myResp.PA.vect,
expl.var = myExpl,
nb.rep = 4,
nb.absences = 1000,
strategy = 'sre',
sre.quant = 0.025)
# user.defined method
myPAtable <- data.frame(PA1 = ifelse(myResp == 1, TRUE, FALSE),
PA2 = ifelse(myResp == 1, TRUE, FALSE))
for (i in 1:ncol(myPAtable)) myPAtable[sample(which(myPAtable[, i] == FALSE), 500), i] = TRUE
PA.u <- bm_PseudoAbsences(resp.var = myResp.PA.vect,
expl.var = myExpl,
strategy = 'user.defined',
user.table = myPAtable)
str(PA.r)
head(PA.r$pa.tab)
apply(PA.r$pa.tab, 2, table)
head(PA.d$pa.tab)
apply(PA.d$pa.tab, 2, table)
head(PA.s$pa.tab)
apply(PA.s$pa.tab, 2, table)
tail(PA.u$pa.tab)
apply(PA.u$pa.tab, 2, table)
# random method : different number of PA
PA.r_mult <- bm_PseudoAbsences(resp.var = myResp.PA.vect,
expl.var = myExpl,
nb.rep = 4,
nb.absences = c(1000, 500, 500, 200),
strategy = 'random')
str(PA.r_mult)
head(PA.r_mult$pa.tab)
apply(PA.r_mult$pa.tab, 2, table)