community_sim {bamm}R Documentation

community_bam: Community bamm

Description

Estimate community dynamics using the bamm framework

Usage

community_sim(
  en_models,
  ngbs_vect,
  init_coords,
  nsteps,
  threshold_vec = NULL,
  stochastic_dispersal = FALSE,
  disp_prop2_suitability = TRUE,
  disper_prop = 0.5
)

Arguments

en_models

A stack or directory with the ecological niche models for each species in the community.

ngbs_vect

A vector containing the number of neighbors for each adjacency matrix of each species in the community see adj_mat.

init_coords

A data.frame with 3 columns: sp_name, x and y; x is the longitude and y is the latitude of initial dispersal points

nsteps

Number of iteration steps for the simulation.

threshold_vec

A vector of threshold values used to bnarize niche models.

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 declared in the parameter 'disper_prop'.

disper_prop

Probability of dispersal to reachable cells.

Details

Each element in community_sim is an object of class. For more details about the simulation see sdm_sim. bam.

Value

An object of class community_sim. The object contains simulation results for each species in the community.

Author(s)

Luis Osorio-Olvera & Jorge Soberon

References

SoberĂ³n J, Osorio-Olvera L (2022). “A Dynamic Theory of the Area of Distribution.” doi:10.48550/ARXIV.2212.06308, https://arxiv.org/abs/2212.06308..

Examples


lagos_path <- system.file("extdata/conejos",
                          package = "bamm")
enm_path <- list.files(lagos_path,
                       pattern = ".tif",
                       full.names = TRUE)[seq(1,10)]
en_models <- raster::stack(enm_path)
ngbs_vect <- sample(1:2,replace = TRUE,
                    size = raster::nlayers(en_models))
init_coords <- read.csv(file.path(lagos_path,
                                  "lagos_initit.csv"))[seq(1,10),]
nsteps <- 12
sdm_comm <- bamm::community_sim(en_models = en_models,
                                ngbs_vect = ngbs_vect,
                                init_coords = init_coords,
                                nsteps = nsteps)

com_pam <- bamm::csim2pam(sdm_comm,which_steps = seq(1,nsteps))
rich_pam <- pam2richness(com_pam,which_steps = c(1,5,10))
raster::plot(rich_pam)


[Package bamm version 0.4.3 Index]