Adds a new kernel to the proto_ipm structure.

define_kernel(
proto_ipm,
name,
formula,
family,
...,
data_list = list(),
states,
uses_par_sets = FALSE,
par_set_indices = list(),
age_indices = list(),
evict_cor = FALSE,
evict_fun = NULL,
integrate = TRUE
)

## Arguments

proto_ipm

The name of the model.

name

The name of the new kernel.

formula

A bare expression specifying the form of the kernel.

family

The type of kernel. Options are "CC" for continuous to continuous transitions, "DC" for discrete to continuous (e.g. emergence from a seedbank), "CD" for continuous to discrete (e.g. entering a seedbank), and "DD" for discrete to discrete (e.g. stasis in a seedbank).

...

A set of named expressions that correspond to vital rates in formula. Parameter set index syntax is supported.

data_list

A list of named values that correspond to constants in the formula and vital rate expressions in ....

states

A list with character vector containing the names of each state variable used in the kernel.

uses_par_sets

A logical indicating whether or not the parameters in the kernel and/or its underlying vital rates are derived from sets. See the introduction vignette for this feature for more details (vignettes(ipmr-introduction', package = 'ipmr')}, and \code{vignettes( index-notation', package = 'ipmr')).

par_set_indices

A named list with vectors corresponding to the values the index variable can take. The names should match the suffixes used in the vital rate expressions.

age_indices

If init_ipm(uses_age = TRUE), a list with possibly 2 entries: 1. "age": the range of possible ages in the model and, optionally, 2. "max_age": the maximum age individuals in the model can attain. Otherwise, not used.

evict_cor

A logical indicating whether an eviction correction should be applied to the kernel.

evict_fun

If evict_cor = TRUE, then a function that corrects for it. Currently, only truncated_distributions and discrete_extrema are possible.

integrate

For simple_* models, this controls whether a "d_z" is automatically appended to the formula argument. When TRUE, this automatically generates formula * d_z. There may be some cases where this behavior is not desirable. Set this to FALSE and specify the correct form if needed. The default is TRUE. This argument is ignored for all general_* models.

## Value

A proto_ipm.

## Details

Different classes of IPMs may have many or only a few kernels. Each one requires its own call to define_kernel, though there are some exceptions, namely for kernels derived for models derived from parameter sets (e.g. vital rate models fit across plots and years).

A much more complete overview of how to generate kernels is provided in vignette("ipmr-introduction", "ipmr").