Generate list of parameters for a consumer-resource model to be passed to sim_rescomp()

spec_rescomp(
  spnum = 1,
  resnum = 1,
  mumatrix,
  kmatrix,
  qmatrix,
  effmatrix = NULL,
  funcresp = "type1",
  essential = FALSE,
  chemo = TRUE,
  mort = 0.03,
  resspeed = 0.03,
  resconc = 1,
  respulse = 0,
  mortpulse = 0,
  pulsefreq = 0,
  batchtrans = FALSE,
  timepars = FALSE,
  totaltime = 1000,
  timeparfreq = 0,
  tpinterp = "inst",
  cinit = 10,
  rinit = NULL,
  introseq = NULL,
  verbose = TRUE
)

Arguments

spnum

Integer vector of length 1 for the number of consumers

resnum

Integer vector of length 1 for the number of resources

mumatrix

Numeric matrix or list of matrices, the elements of which give the maximum growth rates (type 2 or 3) or resource consumption rate constants (type 1, or type 2 when parameterised using conversion efficiencies with effmatrix as opposed to resource quotas with qmatrix). The number of rows and columns should be equal to spnum and resnum respectively. For time dependent parameters (with timepars = TRUE), expects a list of length 2.

kmatrix

Numeric matrix or list of matrices, the elements of which give the of half saturation constants (type 2 or type 3, ignored if funcresp = "type1"). The number of rows and columns should be equal to spnum and resnum respectively. For time dependent parameters (with timepars = TRUE), expects a list of length 2.

qmatrix

Numeric matrix or list of matrices, the elements of which give the resource quotas. The number of rows and columns should be equal to spnum and resnum respectively. For time dependent parameters (with timepars = TRUE), expects a list of length 2. Default = 0.001 for all consumers.

effmatrix

Numeric matrix of resource conversion efficiencies. The number of rows should be equal to spnum and resnum respectively. NB. Incompatible with specification of resource quotas. Function will throw an error if both specified.

funcresp

Character vector of length 1 or length equal to spnum. Options include "type1", 'type2", or "type3".

essential

Logical vector of length 1. If FALSE resources are substitutable.

chemo

Logical. Default is resources supplied continuously (chemostat). If FALSE resources grow logistically.

mort

Numeric vector or list of vectors of length 1 or length = spnum, specifying density independent mortality rates. For time dependent parameters (with timepars = TRUE), expects a list of length 2.

resspeed

Numeric vector of length 1 specifying resource intrinsic rate of increase (if chemo = FALSE), or otherwise chemostat dilution rate. Set to zero for pulsing only. For continuous dilution of resource without resource supply, resspeed should be non-zero with resconc set to zero.

resconc

Numeric vector of length 1 or length = resnum specifying resource carrying capacity (if chemo = FALSE), or otherwise chemostat supply concentration

respulse

Resource pulse size.

mortpulse

Consumer mortality fraction if non-constant mortality (e.g. serial-batch transfer).

pulsefreq

Frequency of resource pulsing and/or intermittent mortality.

batchtrans

If TRUE, both resource is also fractionally sampled (see vignette).

timepars

If TRUE, time dependent parameters required.

totaltime

Total simulation time

timeparfreq

Frequency of parameter switching if timepars = TRUE.

tpinterp

Either "inst" (default), "lin" or "sine" interpolation of time dependent parameters. If "inst", parameters switch instantaneously with frequency given by timeparfreq. If "lin" or "sine", parameters are interpolated linearly or sinusoidaly, respectively, with period 2x timeparfreq.

cinit

Numeric vector of length 1 or length = spnum specifying initialconsumer state values (densities). Defaults to 10 for all consumers.

rinit

Numeric vector of length 1 or length = resnum specifying initial resource state values (concentrations). Defaults to value given in resconc.

introseq

Time sequence as a vector for consumer introductions. Vector length must equal spnum.

verbose

If TRUE (default) prints model and simulation summary specs.

Value

S3 object of class rescomp.

Examples


# Single type I consumer on a single logistically growing resource
spec_rescomp()
#> Model properties 
#>  * 1 consumer(s) and 1 resource(s)
#>  * Consumers have type 1 functional responses
#>  * Resource supply is continuous (e.g. chemostat)
#>  * Mortality is continuous
#> 
#> Simulation properties 
#>  * Simulation time: 1000 time steps
#>  * Init state: consumer(s) = [10], resource(s) = [1]

# Two type II consumers and two substitutable resources in a chemostat
pars <- spec_rescomp(
  spnum = 2,
  resnum = 2,
  funcresp = "type2",
  mumatrix = matrix(c(
    0.7, 0.3,
    0.4, 0.5
  ),
  nrow = 2,
  ncol = 2,
  byrow = TRUE
  ),
  resspeed = 3,
  resconc = 1,
  chemo = TRUE,
  essential = FALSE
)
#> Model properties 
#>  * 2 consumer(s) and 2 resource(s)
#>  * Consumers have type 2 functional responses
#>  * Resources are substitutable
#>  * Resource supply is continuous (e.g. chemostat)
#>  * Mortality is continuous
#> 
#> Simulation properties 
#>  * Simulation time: 1000 time steps
#>  * Init state: consumer(s) = [10, 10], resource(s) = [1, 1]