# Add constrains to the modelled distribution projection through the MigClim approach

Source:`R/add_constraint_MigClim.R`

`add_constrain_MigClim.Rd`

This function adds constrain as defined by the MigClimto approach (Engler et al. 2013)
to a `BiodiversityScenario`

object to
constrain future projections. For a detailed description of MigClim, please the respective reference
and the UserGuide. **The default parameters chosen here are suggestions.**

## Usage

```
# S4 method for BiodiversityScenario, character, numeric, numeric, character, numeric, numeric, numeric, numeric, numeric, character
add_constrain_MigClim(mod, rcThresholdMode, dispSteps, dispKernel, barrierType, lddFreq, lddRange, iniMatAge, propaguleProdProb, replicateNb, dtmp)
```

## Arguments

- mod
A

`BiodiversityScenario`

object with specified predictors.- rcThresholdMode
A

`character`

of either**binary**or**continuous**value. Default:**continuous**- dispSteps
`numeric`

parameters on the number of dispersal steps. Dispersal steps are executed for each timestep (prediction layer) and ideally should be aligned with the number of steps for projection. Minimum is`1`

(Default) and maximum is`99`

.- dispKernel
A

`vector`

with the number of the dispersal Kernel to be applied. Can be set either to a uniform numeric vector, e.g.`c(1,1,1,1)`

or to a proportional decline`(1,0.4,0.16,0.06,0.03)`

(Default)**Depending on the resolution of the raster, this parameter needs to be adapted**- barrierType
A character indicating whether any set barrier should be set as

`'strong'`

or`'weak'`

barriers. Strong barriers prevent any dispersal across the barrier and weak barriers only do so if the whole dispKernel length is covered by the barrier (Default:`'strong'`

).- lddFreq
`numeric`

parameter indicating the frequency of long-distance dispersal (LDD) events. Default is`0`

, so no long-distance dispersal.- lddRange
A

`numeric`

value highlighting the minimum and maximum distance of LDD events.**Note: The units for those distance are in cells, thus the projection units in the raster.**- iniMatAge
Initial maturity age. Used together with

`propaguleProd`

as a proxy of population growth. Must be set to the cell age in time units which are dispersal steps (Default:`1`

).- replicateNb
Number of replicates to be used for the analysis (Default:

`10`

).- dtmp
A

`character`

to a folder where temporary files are to be created.- propaguleProd
Probability of a source cell to produce propagules as a function of time since colonization. Set as probability vector that defines the probability of a cell producing propagules.

## Value

Adds a MigClim onstrain to a `BiodiversityScenario`

object.

## References

Engler R., Hordijk W. and Guisan A. The MIGCLIM R package – seamless integration of dispersal constraints into projections of species distribution models. Ecography,

Robin Engler, Wim Hordijk and Loic Pellissier (2013). MigClim: Implementing dispersal into species distribution models. R package version 1.6.

## Examples

```
if (FALSE) {
# Assumes that a trained 'model' object exists
mod <- scenario(model) |>
add_predictors(env = predictors, transform = 'scale', derivates = "none") |>
add_constrain_MigClim() |>
project()
}
```