simulation: Run a simulation

View source: R/simulation_results-class.R

simulationR Documentation

Run a simulation

Description

A simulation changes landscape objects based on selected dynamics over a specified number of timesteps.

Usage

simulation(
  landscape,
  population_dynamics,
  habitat_dynamics = list(),
  demo_stochasticity = c("full", "none"),
  timesteps = 3,
  replicates = 1,
  verbose = TRUE,
  future.globals = list()
)

Arguments

landscape

a landscape object representing the initial habitat and population

population_dynamics

a population_dynamics object describing how population changes over time

habitat_dynamics

optional list of functions to modify the landscape at each timestep - see habitat_dynamics_functions

demo_stochasticity

how should population rounding occur, if at all - "full" uses a multinomial draw to return rounded cell populations (default) whilst "none" returns non-integer cell populations (no rounding). Note, this parameter specification is used consistently throughout all functions in a simulation.

timesteps

number of timesteps used in one simulation

replicates

number of simulations to perform

verbose

print messages and progress to console? (default is TRUE)

future.globals

a list of custom functions, and objects called by the functions, that a user has created in the global environment for use in a simulation. Note this is only required when running simulations in parallel (e.g. plan(multisession)).

Value

An object of class simulation_results

Examples


## Not run: 
ls <- landscape(population = egk_pop, suitability = egk_hab, carrying_capacity = egk_k)

pd <- population_dynamics(change = growth(egk_mat),
                          dispersal = kernel_dispersal(max_distance = 2000,
                                        dispersal_kernel = exponential_dispersal_kernel(
                                          distance_decay = 1000)),
                          density_dependence = ceiling_density())

# Run a simulation with full demographic stochasticity and without any habitat
# dynamics for tewnty timesteps.
sim <- simulation(landscape = ls,
                  population_dynamics = pd,
                  habitat_dynamics = NULL,
                  timesteps = 20)

## End(Not run)

steps documentation built on Oct. 5, 2022, 1:06 a.m.