Implements the SAMC algorithm from samc.

samc(
  resistance,
  absorption = NULL,
  fidelity = NULL,
  directions = 8,
  kernel = NULL,
  resistance_na_mask = 0,
  absorption_na_mask = 0,
  fidelity_na_mask = 0,
  symmetric = TRUE
)

distribution(samc, occ, time = 1, dead = NULL)

Arguments

absorption

A RasterLayer-class or matrix

fidelity

A RasterLayer-class or matrix

directions

Either 4 (rook) or 8 (queen), the directions of movement.

kernel

Alternative to "directions", a square kernel.

resistance_na_mask

Default to 0, the value to give to NAs and NaNs values in resistance.

absorption_na_mask

Default to 0, the value to give to NAs and NaNs values in absorption.

fidelity_na_mask

Default to 0, the value to give to NAs and NaNs values in fidelity.

symmetric

Default to true, whether movement is symmetrical between cells.

samc

A list resulting from calling samc.

occ

The initial state of the model (abundance matrix).

time

A positive integer or a vector of positive integers representing time steps.

dead

Optionnal matrix containing information on deaths.

Value

samc will return a list. distribution will also return a list.

Examples

library(raster)
#> Loading required package: sp
res <- LSTDConnect::ghm
occ <- 101 - res
high_mort <- 0.25
low_mort <- 0.01
cutoff <- 80
mort <- res
mort[mort >= cutoff] <- high_mort
mort[mort < cutoff] <- low_mort
samc_cache <- LSTDConnect::samc(resistance = res, absorption = mort, 
                                directions = 4)
dists <- LSTDConnect::distribution(samc = samc_cache, occ = occ, time = 1000)