Functions that access slots of a *_ipm (including proto_ipm). default methods correspond to *_ipm objects.

domains(object)

# S3 method for proto_ipm
domains(object)

# S3 method for default
domains(object)

vital_rate_exprs(object)

# S3 method for proto_ipm
vital_rate_exprs(object)

# S3 method for default
vital_rate_exprs(object)

vital_rate_funs(ipm)

# S3 method for ipmr_ipm
vital_rate_funs(ipm)

vital_rate_exprs(object, kernel, vital_rate) <- value

# S3 method for proto_ipm
vital_rate_exprs(object, kernel, vital_rate) <- value

new_fun_form(form)

kernel_formulae(object)

# S3 method for proto_ipm
kernel_formulae(object)

# S3 method for default
kernel_formulae(object)

kernel_formulae(object, kernel) <- value

# S3 method for proto_ipm
kernel_formulae(object, kernel) <- value

parameters(object)

# S3 method for proto_ipm
parameters(object)

# S3 method for default
parameters(object)

parameters(object, ...) <- value

# S3 method for proto_ipm
parameters(object, ...) <- value

int_mesh(ipm, full_mesh = TRUE)

# S3 method for ipmr_ipm
int_mesh(ipm, full_mesh = TRUE)

pop_state(object)

# S3 method for proto_ipm
pop_state(object)

# S3 method for default
pop_state(object)

Arguments

object

A proto_ipm or object created by make_ipm().

ipm

An object created by make_ipm(). This argument only applies to int_mesh() and vital_rate_funs() (because these quantities don't exist until make_ipm() is called).

kernel

The name of the kernel to insert the new vital rate expression into.

vital_rate

The name of the vital rate to replace. If the vital rate doesn't already exist in the object, a new one with this name will be created.

value

For parameters<-, a named list of new parameters. The new list does not need to contain all of the parameters, just the ones to update/append. For vital_rate_exprs<- and kernel_formulae<-, a new functional form. The new functional form must be wrapped in a call to new_fun_form.

form

An expression representing the new vital rate or kernel formula to insert.

...

Additional arguments used in RPadrino methods.

full_mesh

Return the full integration mesh? Default is TRUE. FALSE returns only unique values for each state variable.

Value

Depending on the class of object, a list with types numeric or character.

Details

The *.default method corresponds to output from make_ipm(), and the *.proto_ipm methods correspond to outputs from define_*.

When using kernel_formulae<- and vital_rates_exprs<-, the right hand side of the expression must be wrapped in new_fun_form. See examples.

Note that when using vital_rate_funs, unless the vital rate expression explicitly contains an expression for integration, these functions are not yet integrated! This is useful for things like sensitivity and elasticity analysis, but care must be taken to not use these values incorrectly.

Examples


data(gen_di_det_ex)

proto <- gen_di_det_ex$proto_ipm

# Create a new, iterated IPM
new_ipm <- make_ipm(proto, iterate = TRUE,
                    iterations = 100, return_all_envs = TRUE)

vital_rate_exprs(new_ipm)
#> g: dnorm(ht_2, g_mu, g_sd)
#> g_mu: g_int + g_slope * ht_1
#> s: inv_logit_2(s_int, s_slope, s_slope_2, ht_1)
#> f_r: inv_logit(f_r_int, f_r_slope, ht_1)
#> f_s: exp(f_s_int + f_s_slope * ht_1)
#> f_d: dnorm(ht_2, f_d_mu, f_d_sd)
kernel_formulae(new_ipm)
#> P: s * g * d_ht
#> go_discrete: f_r * f_s * g_i * d_ht
#> stay_discrete: 0
#> leave_discrete: e_p * f_d * d_ht
vital_rate_funs(new_ipm)
#> $P
#> g (not yet discretized): A 200 x 200 kernel with minimum value: 0 and maximum value: 0.0344
#> g_mu (not yet discretized): A 200 x 200 kernel with minimum value: 8.3275 and maximum value: 620.7542
#> s (not yet discretized): A 200 x 200 kernel with minimum value: 0.001 and maximum value: 1
#> 
#> $go_discrete
#> f_r (not yet discretized): A 1 x 200 row vector with minimum value: 0 and maximum value: 1
#> f_s (not yet discretized): A 1 x 200 row vector with minimum value: 14.1933 and maximum value: 34141.8242
#> 
#> $stay_discrete
#> No vital rates specified
#> 
#> $leave_discrete
#> f_d (not yet discretized): A 200 x 1 column vector with minimum value: 0 and maximum value: 0.1948
#> 

domains(new_ipm)
#> ht: lower_bound = 1.02, upper_bound = 624, n_meshpoints = 200
parameters(new_ipm)
#>      g_int    g_slope       g_sd      s_int    s_slope  s_slope_2    f_r_int 
#>   5.781000   0.988000  20.556990  -0.352000   0.122000  -0.000213 -11.460000 
#>  f_r_slope    f_s_int  f_s_slope     f_d_mu     f_d_sd        e_p        g_i 
#>   0.083500   2.620400   0.012560   5.665500   2.073400   0.150000   0.506700 

# Usage is the same for proto_ipm's as *_ipm's

vital_rate_exprs(proto)
#> g: dnorm(ht_2, g_mu, g_sd)
#> g_mu: g_int + g_slope * ht_1
#> s: inv_logit_2(s_int, s_slope, s_slope_2, ht_1)
#> f_r: inv_logit(f_r_int, f_r_slope, ht_1)
#> f_s: exp(f_s_int + f_s_slope * ht_1)
#> f_d: dnorm(ht_2, f_d_mu, f_d_sd)
kernel_formulae(proto)
#> P: s * g * d_ht
#> go_discrete: f_r * f_s * g_i * d_ht
#> stay_discrete: 0
#> leave_discrete: e_p * f_d * d_ht

domains(proto)
#> ht: lower_bound = 1.02, upper_bound = 624, n_meshpoints = 200
parameters(proto)
#>      g_int    g_slope       g_sd      s_int    s_slope  s_slope_2    f_r_int 
#>   5.781000   0.988000  20.556990  -0.352000   0.122000  -0.000213 -11.460000 
#>  f_r_slope    f_s_int  f_s_slope     f_d_mu     f_d_sd        e_p        g_i 
#>   0.083500   2.620400   0.012560   5.665500   2.073400   0.150000   0.506700 

int_mesh(new_ipm)
#> d_ht - 3.1149
#> ht_1 - Lower bound: 2.57745, Upper bound: 622.44255, # of Meshpoints: 200
#> ht_2 - Lower bound: 2.57745, Upper bound: 622.44255, # of Meshpoints: 200

# Setting new parameters, vital rate expressions, and kernel formulae
# only works on proto_ipm's.

# This replaces the "g_int" parameter and leaves the rest untouched

parameters(proto) <- list(g_int = 1.5)

# This creates a new g_z parameter and leaves the rest of parameters untouched
parameters(proto) <- list(g_z = 2.2)

# setting a new vital rate or kernel expression requires wrapping the
# right-hand side in a call to new_fun_form(). new_fun_form uses expressions
# with the same format as ... in define_kernel()

vital_rate_exprs(proto,
                 kernel = "P",
                 vital_rate = "g_mu") <- new_fun_form(g_int + g_z + g_slope * ht_1)

kernel_formulae(proto, kernel = "stay_discrete") <- new_fun_form(g_z * d_ht)