create_fields: Create species distribution fields

create_fieldsR Documentation

Create species distribution fields

Description

create_fields parametrises and returns the spatio-temporal fields used for the spatial distribution of fish populations and movement in space and time for the simulations.

The spatio-temporal fields are generated using spate.sim function from the spate package using an advective-diffusion Stochastic Partial Differential Equation (SPDE). See Lindgren 2011 and Sigrist 2015 for further detail.

Usage

create_fields(
  npt = 1000,
  t = 1,
  seed = 123,
  n.spp = NULL,
  spp.ctrl = NULL,
  plot.dist = FALSE,
  plot.file = getwd()
)

Arguments

npt

Numeric integer with the dimensions of the field in npt * npt

t

Numeric integer with the number of time-steps in the simulation

seed

(Optional) Numeric integer with the seed for the simulation

n.spp

Numeric integer with the number of species to be simulated. Each species must have an individual control list as detailed below.

spp.ctrl

List of controls to generate each species spatio-temporal distribution. Must be of the form spp.ctrl = list(spp.1 = c(rho0 = 0.001, ...), spp.2 = c(rho0 = 0.001, ..),..) and contain the following:

  • rho0 (>=0) Controls the range in a matern covariance structure.

  • sigma2 (>=0) Controls the marginal variance (i.e. process error) in the matern (>=0) covariance structure.

  • zeta (>=0) Damping parameter; regulates the temporal correlation.

  • rho1 (>=0) Range parameter for the diffusion process

  • gamma (>=0) Controls the level of anisotropy

  • alpha ([0, \pi/2]) Controls the direction of anisotropy

  • muX ([-0.5, 0.5]) x component of drift effect

  • muY ([-0.5, 0.5]) y component of drift effect

  • tau2 (>=0) Nugget effect (measurement error)

  • nu Smoothness parameter for the matern covariance function

plot.dist

Boolean, whether to plot the distributions to file

plot.file

path to save the plots of the species distributions

Value

Silently returns a list of spatial distributions with first level of the list being the population (1 -> n.spp) and the second being time (1 -> t). If plot.dist = TRUE it produces an image of the spatial distributions at each time step for each of the populations saved to the working directory (unless specified otherwise in plot.file)

Examples

fields <- create_fields(n.spp = 1, t = 2, 
      spp.ctrl = list(
      'spp.1' = c('rho0' = 0.1, 'sigma2' = 1, 'zeta' = 0.1,
		  'rho1' = 0.01, 'gamma' = 0.3, 'alpha' = pi/4,
		  'muX' = -0.05, 'muY' = -0.05, 'tau2' = 0, 'nu' = 1.5)),
		plot.dist = TRUE, plot.file = getwd())

pdolder/MixFishSim documentation built on Oct. 17, 2023, 4:25 p.m.