simulation_results: Run an simulation

Description Usage Arguments Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
simulation(state, dynamics, timesteps, replicates = 1,
  parallel = FALSE)

is.simulation_results(x)

## S3 method for class 'simulation_results'
print(x, ...)

## S3 method for class 'simulation_results'
plot(x, object = "population",
  type = "graph", stage = NULL, animate = FALSE,
  timesteps = c(1:9), panels = c(3, 3), ...)

Arguments

state

a state object - static habitat, population, and demography in a timestep

dynamics

a dynamics object - modules that change habitat, population, and demography during a simulation

timesteps

number of timesteps used in one simulation or to display when plotting rasters

replicates

number simulations to perform

parallel

should parallel processors be used for simulations (default is FALSE)

x

an simulation_results object

...

further arguments passed to or from other methods

object

the state object to plot - can be 'population' (default), 'habitat_suitability' or 'carrying_capacity'

type

the plot type - 'graph' (default) or 'raster'

stage

life-stage to plot - must be specified for 'raster' plot types; default is NULL and all life-stages will be plotted

animate

if plotting type 'raster' would you like to animate the rasters as a gif?

panels

the number of columns and rows to use when plotting raster timeseries - default is 3 x 3 (e.g. c(3,3) )

Value

An object of class simulation_results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(steps)
library(raster)
library(future)
plan(multiprocess)

state <- state(population(egk_pop),
               habitat(egk_hab, egk_k),
               demography(egk_mat))

dynamics <- dynamics(habitat_dynamics(),
                     demography_dynamics(),
                     population_dynamics())

results <- simulation(state, dynamics, timesteps = 10, replicates = 5)

# Test if object is of the type 'simulation_results'

is.simulation_results(results)

print(results)

plot(results)

skiptoniam/dhmpr documentation built on Sept. 26, 2018, 3:11 p.m.