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)
A RasterLayer-class
or matrix
A RasterLayer-class
or matrix
Either 4 (rook) or 8 (queen), the directions of movement.
Alternative to "directions", a square kernel.
Default to 0, the value to give to NAs and NaNs values in resistance.
Default to 0, the value to give to NAs and NaNs values in absorption.
Default to 0, the value to give to NAs and NaNs values in fidelity.
Default to true, whether movement is symmetrical between cells.
A list resulting from calling samc.
The initial state of the model (abundance matrix).
A positive integer or a vector of positive integers representing time steps.
Optionnal matrix containing information on deaths.
samc
will return a list.
distribution
will also return a list.
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)