sdm_sim: sdm_sim: Simulate single species dispersal dynamics using the...

View source: R/sdm_sim.R

sdm_simR Documentation

sdm_sim: Simulate single species dispersal dynamics using the BAM framework.

Description

sdm_sim: Simulate single species dispersal dynamics using the BAM framework.

Usage

sdm_sim(
  set_A,
  set_M,
  initial_points,
  nsteps,
  stochastic_dispersal = TRUE,
  disp_prop2_suitability = TRUE,
  disper_prop = 0.5,
  progress_bar = TRUE
)

Arguments

set_A

A setA object returned by the function model2sparse

set_M

A setM object cointaining the adjacency matrix of the study area. See adj_mat

initial_points

A sparse vector returned by the function occs2sparse

nsteps

Number of steps to run the simulation

stochastic_dispersal

Logical. If dispersal depends on a probability of visiting neighbor cells (Moore neighborhood).

disp_prop2_suitability

Logical. If probability of dispersal is proportional to the suitability of reachable cells. The proportional value must be declered in the parameter 'disper_prop'.

disper_prop

Probability of dispersal to reachable cells.

progress_bar

Show progress bar

Examples

## Not run: 
model_path <- system.file("extdata/Lepus_californicus_cont.tif",
                          package = "bam")
model <- raster::raster(model_path)

sparse_mod <- bam::model2sparse(model,threshold=0.05)
adj_mod <- bam::adj_mat(sparse_mod,ngbs=1)
occs_lep_cal <- data.frame(longitude = c(-110.08880,
                                         -98.89638),
                           latitude = c(30.43455,
                                        25.19919))

occs_sparse <- bam::occs2sparse(modelsparse = sparse_mod,
                                occs = occs_lep_cal)
sdm_lep_cal <- bam::sdm_sim(set_A = sparse_mod,
                            set_M = adj_mod,
                            initial_points = occs_sparse,
                            nsteps = 10,
                            stochastic_dispersal = TRUE,
                            disp_prop2_suitability=TRUE,
                            disper_prop=0.5,
                            progress_bar=TRUE)

## End(Not run)

luismurao/bam documentation built on Nov. 28, 2022, 3:02 p.m.