ipmr_generics: Padrino methods for 'ipmr' generic functions

vital_rate_exprs.pdb_proto_ipm_listR Documentation

Padrino methods for 'ipmr' generic functions

Description

Provides wrappers around ipmr generic functions to extract some quantities of interest from pdb_proto_ipm_lists and pdb_ipms.

Usage

## S3 method for class 'pdb_proto_ipm_list'
vital_rate_exprs(object)

## S3 method for class 'pdb_ipm'
vital_rate_exprs(object)

## S3 method for class 'pdb_proto_ipm_list'
kernel_formulae(object)

## S3 method for class 'pdb_ipm'
kernel_formulae(object)

## S3 method for class 'pdb_proto_ipm_list'
domains(object)

## S3 method for class 'pdb_ipm'
domains(object)

## S3 method for class 'pdb_proto_ipm_list'
parameters(object)

## S3 method for class 'pdb_ipm'
parameters(object)

## S3 method for class 'pdb_proto_ipm_list'
pop_state(object)

## S3 method for class 'pdb_ipm'
pop_state(object)

## S3 method for class 'pdb_ipm'
vital_rate_funs(ipm)

## S3 method for class 'pdb_ipm'
int_mesh(ipm, full_mesh = TRUE)

## S3 method for class 'pdb_ipm'
lambda(ipm, ...)

## S3 method for class 'pdb_ipm'
right_ev(ipm, iterations = 100, tolerance = 1e-10, ...)

## S3 method for class 'pdb_ipm'
left_ev(ipm, iterations = 100, tolerance = 1e-10, ...)

## S3 method for class 'pdb_ipm'
is_conv_to_asymptotic(ipm, tolerance = 1e-10, burn_in = 0.1)

## S3 method for class 'pdb_ipm'
conv_plot(ipm, iterations = NULL, log = FALSE, show_stable = TRUE, ...)

## S3 method for class 'pdb_ipm'
make_iter_kernel(ipm, ..., name_ps = NULL, f_forms = NULL)

## S3 method for class 'pdb_ipm'
mean_kernel(ipm)

pdb_new_fun_form(...)

## S3 replacement method for class 'pdb_proto_ipm_list'
parameters(object, ...) <- value

## S3 replacement method for class 'pdb_proto_ipm_list'
vital_rate_exprs(object, kernel = NULL, vital_rate = NULL) <- value

## S3 replacement method for class 'pdb_proto_ipm_list'
kernel_formulae(object, kernel) <- value

## S3 method for class 'pdb_ipm'
x[i]

Arguments

object

An object produced by pdb_make_proto_ipm or pdb_make_ipm.

ipm

A pdb_ipm.

full_mesh

Logical. Return the complete set of meshpoints or only the unique ones.

...

Usage depends on the function - see Details and Examples.

iterations

The number of times to iterate the model to reach convergence. Default is 100.

tolerance

Tolerance to evaluate convergence to asymptotic dynamics.

burn_in

The proportion of iterations to discard as burn in when assessing convergence.

log

Log-transform lambdas for plotting?

show_stable

Show horizontal line denoting stable population growth?

name_ps

For pdb_ipm objects that contain age_x_size IPMs, a named list. The names of the list should be the ipm_ids that are age_x_size models, and the values in the list should be the the name of the survival/growth kernels.

f_forms

For pdb_ipm objects that contain age_x_size IPMs, a named list. The names of the list should be the ipm_ids that are age_x_size models, and the values in the list should be the the name of the fecundity kernels. If multiple sub-kernels contribute to fecundity, we can also supply a string specifying how they are combined (e.g. f_forms = "F + C").

value

The value to insert. See details and Examples.

kernel

Ignored, present for compatibility with ipmr.

vital_rate

Ignored, present for compatibility with ipmr.

x

A pdb_ipm object.

i

The index to extract

Details

There are number of uses for ... which depend on the function used for them. These are described below.

Value

Most of these return named lists where names correspond to ipm_ids. The exception is pdb_new_fun_form, which returns a list of expressions. It is only intended for setting new expressions with vital_rate_exprs<-.

pdb_new_fun_form

This must be used when setting new expressions for vital rates and kernel formulae. The ... argument should be a named list of named lists. The top most layer should be ipm_id's. The next layer should be a list where the names are vital rates you wish to modify, and the values are the expressions you want to insert. See examples.

make_iter_kernel

The ... here should be expressions representing the block kernel of the IPMs in question. The names of each expression should be the ipm_id, and the expressions should take the form of c(<upper_left>, <upper_right>, <lower_left>, <lower_right>) (i.e. a vector of symbols would create a matrix in row-major order). See examples.

conv_plot/lambda

The ... are used pass additional arguments to lambda and conv_plot.

Examples


data(pdb)
my_pdb <- pdb_make_proto_ipm(pdb, c("aaaa17", "aaa310"))

# These values will be appended to the parameter list for each IPM, as they
# aren't currently present in them.

parameters(my_pdb) <- list(
  aaa310 = list(
    g_slope_2 = 0.0001,
    establishment_prob = 0.02
  ),
  aaaa17 = list(
    g_var = 4.2,
    germ_prob = 0.3
  )
)

# We can overwrite a parameter value with a new one as well. Old values aren't
# saved anywhere except in the pdb object, so be careful!

parameters(my_pdb) <- list(
  aaa310 = list(
    s_s    = 0.93, # old value is 0.92
    gvar_i = 0.13 # old value is 0.127
  )
)

vital_rate_exprs(my_pdb) <- pdb_new_fun_form(
    list(
      aaa310 = list(mu_g = g_int + g_slope * size_1 + g_slope_2 * size_1^2),
      aaaa17 = list(sigmax2 = sqrt(g_var * exp(cfv1 + cfv2 * size_1))
     )
   )
 )

 kernel_formulae(my_pdb) <- pdb_new_fun_form(
   list(
     aaaa17 = list(Y = recr_size * yearling_s * germ_prob * d_size),
     aaa310 = list(F = f_n * f_d * establishment_prob)
   )
 )

 my_ipms    <- pdb_make_ipm(my_pdb)
 iter_kerns <- make_iter_kernel(my_ipms, aaaa17 = c(0, F_yr, Y, P_yr))


Rpadrino documentation built on April 30, 2022, 1:05 a.m.