Skip to contents

M is the area that has been accessible to the species over a relevant period. Instead of drawing a hull or buffers around the records, m_simulate() simulates that history, following the method of Machado-Stredel et al. (2021), in a stable climate or through a glacial cycle (past), which is conceptually closer to the definition of M than any geometry:

Usage

m_simulate(
  points,
  env,
  barrier = NULL,
  n_rep = 10,
  n_events = 20,
  kernel_sd = 1,
  max_dispersers = 4,
  niche_level = 0.95,
  access_threshold = 0.05,
  past = NULL,
  periods = c(to_glacial = 5, glacial = 10, to_current = 5, current = 10),
  span_ka = 1,
  pc_cumvar = 0.95,
  max_pc = 3,
  max_cells = 2e+06,
  coords = NULL,
  points_crs = "EPSG:4326",
  seed = 1
)

Arguments

points

Records: a data.frame with coordinates, a CSV path, sf or terra::SpatVector.

env

Predictor layers covering a generous study region (larger than any plausible M), terra::SpatRaster or files.

barrier

Optional barriers to dispersal: polygons (sf, SpatVector, path) or a raster whose cells other than NA and 0 are barriers.

n_rep, n_events

Replicates and dispersal events per replicate.

kernel_sd

Standard deviation of the dispersal kernel, in cells.

max_dispersers

Largest number of dispersers per colonised cell and event.

niche_level

Chi-squared quantile that bounds the niche ellipsoid.

access_threshold

Share of the least accessed cells left out of M.

past

Optional layers of a glacial climate with the names of env (on its grid, or resampled to it), for a glacial cycle.

periods

Durations (thousands of years) of the transition to glacial conditions, the glacial period, the transition back and the current period.

span_ka

Duration of one climatic scenario (thousands of years).

pc_cumvar, max_pc

Principal components used for the niche.

max_cells

Largest grid simulated; larger grids are aggregated.

coords, points_crs

Coordinate columns and their CRS.

seed

Random seed.

Value

An object of class m_simulation: m (M as polygons, sfc in the CRS of env), access (raster of the mean number of accesses), suitability (the niche suitability today), m_raster (1 in M), report (records, starting records inside the niche, records added, cells and area, cells accessed that have no values today, replicates in which the species went extinct) and settings.

Details

  1. Niche. An ellipsoid in the space of the first principal components of the layers (those explaining pc_cumvar of the variance, at most max_pc), with the centroid and covariance of the records. A cell is suitable when its Mahalanobis distance from the centroid is within the niche_level quantile of the chi-squared distribution (default 0.95, leaving out the most extreme 5%), with suitability exp(-0.5 * MD^2).

  2. Dispersal. In each of n_rep replicates, a random half of the records inside the niche are the starting populations. In each of n_events dispersal events, every colonised cell sends dispersers in random directions over distances drawn from a normal kernel with standard deviation kernel_sd (in cells): 1 to max_dispersers of them, more from more suitable cells. Every cell reached is accessed; it is colonised, and sends dispersers itself, only if suitable. Cells without values (the sea, cells outside the layers) and barrier cells can be neither accessed nor colonised, so dispersal can only jump a barrier narrower than the kernel allows.

  3. M. The mean number of accesses per cell over the replicates; the accessed cells, without the access_threshold share (default 5%) accessed least often, form M. The cells of all records are always added, and their number is reported.

Past climate (their "changing framework"). With past (the same layers for a glacial period, e.g. the Last Glacial Maximum from CHELSA-TraCE21k), the simulation runs through a cycle of climatic scenarios of span_ka thousand years each: a transition from current-like to glacial conditions, a glacial period, a transition back and a current period (periods, in thousands of years; default 5, 10, 5 and 10, as in their paper). Transitional climates are weighted means of the two layers, projected with the PCA of the present, and each scenario lasts n_events events. Populations go extinct where a new scenario is unsuitable, so the records' areas may have been reached from refugia. Cells with values only in the past (e.g. shelves exposed at low sea level) are land while the glacial weight dominates and can carry dispersal; M itself is the accessed cells that have values today (the others are counted in the report).

The simulation works on the whole grid, so it needs the layers in memory: grids with more than max_cells cells are first aggregated on disk (as in grain_sensitivity()). The kernel is in cells of the grid used, so choose kernel_sd and n_events together with the resolution: a disperser moves about kernel_sd cells per event, and M grows with both.

The result can be compared with the other delimitations in m_scenarios() (method = "simulation" in delimit_m(), with env).

Status, assumptions and limits. The method follows Machado-Stredel et al. (2021); the niche in principal components, the glacial cycle interpolated between two climates and the handling of land bridges are preENM's implementation. The result depends on the niche (an ellipsoid from the records, which are themselves biased and possibly truncated), the dispersal kernel, the number of dispersal events and the barriers, none of which is estimated from data, and the past climates are interpolated, not simulated. Treat the result as one hypothesis and vary kernel_sd, n_events and niche_level.

References

Machado-Stredel, F., Cobos, M.E., Peterson, A.T. (2021) A simulation-based method for selecting calibration areas for ecological niche models and species distribution models. Frontiers of Biogeography 13, e48814. doi:10.21425/F5FBG48814

Barve, N., Barve, V., Jimenez-Valverde, A., Lira-Noriega, A., Maher, S.P., Peterson, A.T., Soberon, J., Villalobos, F. (2011) The crucial role of the accessible area in ecological niche modeling and species distribution modeling. Ecological Modelling 222, 1810-1819. doi:10.1016/j.ecolmodel.2011.02.011

Examples

# \donttest{
sim <- simulate_enm_data(seed = 1, n_presence = 60)
ms <- m_simulate(sim$presence, sim$env, n_rep = 5, n_events = 10,
                 kernel_sd = 2, seed = 1)
ms
#> Simulated accessible area (M): 5 replicates x 10 dispersal events, kernel SD 2 cell(s)
#> 
#> IN SHORT
#> - M covers 342 426 km2 (3574 cells): the cells reached by dispersal from
#>   the records, without the 5% least accessed.
#> - 60 of the 60 record cells lie inside the niche ellipsoid and served as
#>   starting populations.
#> - M grows with the kernel and the number of events: compare a few settings,
#>   and other delimitations, with m_scenarios().
#> 
#> Niche: ellipsoid on PC1-PC2 (100% of the variance) bounded at the 0.95
#> chi-squared quantile; up to 4 dispersers per cell and event. Method of
#> Machado-Stredel et al. (2021), stable climate.
plot(ms)

# }