setResource | R Documentation |
Sets the intrinsic resource growth rate and the intrinsic resource carrying capacity as well as the name of the function used to simulate the resource dynamics. By default this function changes both the rate and the capacity together in such a way that the resource replenishes at the same rate at which it is consumed.
setResource(
params,
resource_rate = NULL,
resource_capacity = NULL,
resource_level = NULL,
resource_dynamics = NULL,
balance = NULL,
lambda = resource_params(params)[["lambda"]],
n = resource_params(params)[["n"]],
w_pp_cutoff = resource_params(params)[["w_pp_cutoff"]],
r_pp = deprecated(),
kappa = deprecated(),
...
)
resource_rate(params)
resource_rate(params) <- value
resource_capacity(params)
resource_capacity(params) <- value
resource_level(params)
resource_level(params) <- value
resource_dynamics(params)
resource_dynamics(params) <- value
params |
A MizerParams object |
resource_rate |
Optional. Vector of resource intrinsic birth rates or coefficient in the power-law for the birth rate, see Details. Must be strictly positive. |
resource_capacity |
Optional. Vector of resource intrinsic carrying capacities or coefficient in the power-law for the capacity, see Details. The resource capacity must be larger than the resource abundance. |
resource_level |
Optional. The ratio between the current resource number
density and the resource capacity. Either a number used at all sizes or a
vector specifying a value for each size. Must be strictly between 0 and 1,
except at sizes where the resource is zero, where it can be |
resource_dynamics |
Optional. Name of the function that determines the resource dynamics by calculating the resource spectrum at the next time step from the current state. |
balance |
By default, if possible, the resource parameters are set so that the resource replenishes at the same rate at which it is consumed. In this case you should only specify either the resource rate or the resource capacity (or resource level) because the other is then determined automatically. Set to FALSE if you do not want the balancing. |
lambda |
Used to set power-law exponent for resource capacity if the
|
n |
Used to set power-law exponent for resource rate if the
|
w_pp_cutoff |
The upper cut off size of the resource spectrum power law
used only if |
r_pp |
|
kappa |
|
... |
Unused |
value |
The desired new value for the respective parameter. |
setResource
: A MizerParams object with updated resource parameters
You would usually set the resource dynamics only after having finished the
calibration of the steady state. Then setting the resource dynamics with
this function will preserve that steady state, unless you explicitly
choose to set balance = FALSE
. Your choice of the resource dynamics only
affects the dynamics around the steady state. The higher the resource rate
or the lower the resource capacity the less sensitive the model will be to
changes in the competition for resource.
The resource_dynamics
argument allows you to choose the resource dynamics
function. By default, mizer uses a semichemostat model to describe the
resource dynamics in each size class independently. This semichemostat
dynamics is implemented by the function resource_semichemostat()
. You can
change that to use a logistic model implemented by resource_logistic()
or
you can use resource_constant()
which keeps the resource constant or you
can write your own function.
Both the resource_semichemostat()
and the resource_logistic()
dynamics
are parametrised in terms of a size-dependent rate r_R(w)
and a
size-dependent capacity c_R
. The help pages of these functions give
the details.
The resource_rate
argument can be a vector (with the same length as
w_full(params)
) specifying the intrinsic resource growth rate for each size
class. Alternatively it can be a single number, which is then used as the
coefficient in a power law: then the intrinsic growth rate r_R(w)
at
size w
is set to
r_R(w) = r_R w^{n-1}.
The power-law exponent n
is taken from the n
argument.
The resource_capacity
argument can be a vector specifying the intrinsic
resource carrying capacity for each size class. Alternatively it can be a
single number, which is then used as the coefficient in a truncated power
law: then the intrinsic growth rate c_R(w)
at size w
is set to
c(w) = \kappa\, w^{-\lambda}
for all w
less than w_pp_cutoff
and zero for larger sizes.
The power-law exponent \lambda
is taken from the lambda
argument.
The values for lambda
, n
and w_pp_cutoff
are stored in a list in the
resource_params
slot of the MizerParams object so that they can be re-used
automatically in the future. That list can be accessed with
resource_params()
. It also holds the coefficient kappa
that describes the
steady-state resource abundance.
params <- NS_params
resource_dynamics(params)
resource_dynamics(params) <- "resource_constant"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.