Sets the intrinsic resource birth rate and the intrinsic resource carrying
capacity as well as the name of the function used to simulate the resource
dynamics. By default, the birth rate and the carrying capacity are changed
together in such a way that the resource replenishes at the same rate at
which it is consumed. So you should only provide either the
resource_rate or the resource_capacity (or resource_level) because
the other is determined by the requirement 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
setResource: A MizerParams object with updated resource parameters
A vector with the intrinsic resource birth rate for each size class.
A vector with the intrinsic resource capacity for each size class.
A vector with the ratio between the current resource number density and the resource capacity for each size class.
The name of the function that determines the resource dynamics.
A MizerParams object
Optional. A vector of per-capita resource birth rate for each size class or a single number giving the coefficient in the power-law for this rate, see "Setting resource dynamics" below. Must be strictly positive.
Optional. Vector of resource intrinsic carrying capacities or coefficient in the power-law for the capacity, see "Setting resource dynamics" below. The resource capacity must be larger than the resource abundance.
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 NaN. This
determines the resource capacity, so do not specify both this and
resource_capacity.
Optional. Name of the function that determines the resource dynamics by calculating the resource spectrum at the next time step from the current state.
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.
Used to set power-law exponent for resource capacity if the
resource_capacity argument is given as a single number.
Used to set power-law exponent for resource rate if the
resource_rate argument is given as a single number.
The upper cut off size of the resource spectrum power law
used when resource_capacity is given as a single number. When changing
w_pp_cutoff without providing resource_capacity, the cutoff can only
be decreased. In that case, both the carrying capacity and the initial
resource abundance will be cut off at the new value. To increase the cutoff,
you must also provide the resource_capacity for the extended range.
Unused
The desired new value for the respective parameter.
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 birth 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 birth rate for each size
class. Alternatively it can be a single number that is used as the
coefficient in a power law: then the intrinsic birth 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 that is used as the coefficient in a truncated power
law: then the intrinsic carrying capacity \(c_R(w)\) at size \(w\)
is set to
$$c_R(w) = c_R\, 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().
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.
If you provide the resource_level then that sets the resource_capacity
to the current resource number density divided by the resource level. So
in that case you should not specify resource_capacity as well.
If you provide none of the arguments resource_level, resource_rate or
resource_capacity then the resource rate is kept at its previous value.
setParams()
params <- NS_params
resource_dynamics(params)
resource_dynamics(params) <- "resource_constant"
Run the code above in your browser using DataLab