This internal biomod2 function allows the user to run a rectilinear surface range envelop (SRE) (equivalent to BIOCLIM) using the extreme percentiles (as recommended by Nix or Busby, see References and Details).

```
bm_SRE(
resp.var = NULL,
expl.var = NULL,
new.env = NULL,
quant = 0.025,
do.extrem = FALSE
)
```

- resp.var
a

`vector`

, a`SpatVector`

without associated data (*if presence-only*), or a`SpatVector`

object containing binary data (`0`

: absence,`1`

: presence,`NA`

: indeterminate) for a single species that will be used to build the species distribution model(s)*Note that old format from sp are still supported such as*`SpatialPoints`

(if presence-only) or`SpatialPointsDataFrame`

object containing binary data.- expl.var
a

`matrix`

,`data.frame`

,`SpatVector`

or`SpatRaster`

object containing the explanatory variables (in columns or layers) that will be used to build the SRE model*Note that old format from raster and sp are still supported such as*`RasterStack`

and`SpatialPointsDataFrame`

objects.- new.env
a

`matrix`

,`data.frame`

,`SpatVector`

or`SpatRaster`

object containing the explanatory variables (in columns or layers) that will be used to predict the SRE model*Note that old format from raster and sp are still supported such as*`RasterStack`

and`SpatialPointsDataFrame`

objects.- quant
a

`numeric`

between`0`

and`0.5`

defining the half-quantile corresponding to the most extreme value for each variable not to be taken into account for determining the tolerance boundaries of the considered species (see Details)- do.extrem
(

*optional, default*`FALSE`

)

A`logical`

value defining whether a`matrix`

containing extreme conditions supported should be returned or not

A `vector`

or a `SpatRaster`

object, containing binary
(`0`

or `1`

) values.

*Please refer to References to get more information about surface range envelop models.*

This method is highly influenced by the extremes of the data input. Whereas a linear model
can discriminate the extreme values from the main tendency, the SRE considers them as
important as any other data point leading to changes in predictions.

*The more (non-colinear) variables, the more restrictive the model will be.*

Predictions are returned as binary (`0`

or `1`

) values, a site being either
potentially suitable for all the variables, or out of bounds for at least one variable and
therefore considered unsuitable.

`quant`

determines the threshold from which the data will be taken into account for
calibration. The default value of `0.05`

induces that the `5%`

most extreme values
will be avoided for each variable on each side of its distribution along the gradient, meaning
that a total of `10%`

of the data will not be considered.

Nix, H.A., 1986. A biogeographic analysis of Australian elapid snakes. In:

*Atlas of Elapid Snakes of Australia.*(Ed.) R. Longmore, pp. 4-15.**Australian Flora and Fauna Series Number 7.**Australian Government Publishing Service: Canberra.Busby, Jeremy. BIOCLIM - a bioclimate analysis and prediction system.

*Plant protection quarterly***6**(1991): 8-9.

`bm_PseudoAbsences`

, `BIOMOD_FormatingData`

,
`bm_ModelingOptions`

, `bm_Tuning`

,
`bm_RunModelsLoop`

, `BIOMOD_Modeling`

,

Other Secundary functions:
`bm_BinaryTransformation()`

,
`bm_CrossValidation()`

,
`bm_FindOptimStat()`

,
`bm_MakeFormula()`

,
`bm_ModelingOptions()`

,
`bm_PlotEvalBoxplot()`

,
`bm_PlotEvalMean()`

,
`bm_PlotRangeSize()`

,
`bm_PlotResponseCurves()`

,
`bm_PlotVarImpBoxplot()`

,
`bm_PseudoAbsences()`

,
`bm_RunModelsLoop()`

,
`bm_SampleBinaryVector()`

,
`bm_SampleFactorLevels()`

,
`bm_Tuning()`

,
`bm_VariablesImportance()`

```
library(terra)
## Load real data
data(DataSpecies)
myResp.r <- as.numeric(DataSpecies[, 'GuloGulo'])
data(bioclim_current)
myExpl.r <- rast(bioclim_current)
myRespXY <- DataSpecies[which(myResp.r == 1), c('X_WGS84', 'Y_WGS84')]
myResp.v <- classify(subset(myExpl.r, 1),
matrix(c(-Inf, Inf, 0), ncol = 3, byrow = TRUE))
myResp.v[cellFromXY(myResp.v, myRespXY)] <- 1
## Compute SRE for several quantile values
sre.100 <- bm_SRE(resp.var = myResp.v,
expl.var = myExpl.r,
new.env = myExpl.r,
quant = 0)
sre.095 <- bm_SRE(resp.var = myResp.v,
expl.var = myExpl.r,
new.env = myExpl.r,
quant = 0.025)
sre.090 <- bm_SRE(resp.var = myResp.v,
expl.var = myExpl.r,
new.env = myExpl.r,
quant = 0.05)
## Visualize results
res <- c(myResp.v, sre.100, sre.095, sre.090)
names(res) <- c("Original distribution", "Full data calibration"
, "Over 95 percent", "Over 90 percent")
plot(res)
```