Learn R Programming

ipmr (version 0.0.7)

is_conv_to_asymptotic: Check for model convergence to asymptotic dynamics

Description

Checks for convergence to asymptotic dynamics numerically and visually. is_conv_to_asymptotic checks whether lambda[iterations - 1] equals lambda[iterations] within the specified tolerance, tolerance. conv_plot plots the time series of lambda (or log(lambda)). For stochastic models, a cumulative mean of log(lambda) is used to check for convergence.

Usage

is_conv_to_asymptotic(ipm, tolerance, burn_in)

# S3 method for ipmr_ipm is_conv_to_asymptotic(ipm, tolerance = 1e-06, burn_in = 0.1)

conv_plot(ipm, iterations, log, show_stable, burn_in, ...)

# S3 method for ipmr_ipm conv_plot( ipm, iterations = NULL, log = NULL, show_stable = TRUE, burn_in = 0.1, ... )

Value

is_conv_to_asymptotic: Either TRUE or FALSE. conv_plot: codeipm invisibly.

Arguments

ipm

An object returned by make_ipm().

tolerance

The tolerance for convergence in lambda or, in the case of stochastic models, the cumulative mean of log(lambda).

burn_in

The proportion of iterations to discard. Default is 0.1 (i.e. first 10% of iterations in the simulation). Ignored for deterministic models.

iterations

The range of iterations to plot lambda for. The default is every iteration.

log

A logical indicating whether to log transform lambda. This defaults to TRUE for stochastic models and FALSE for deterministic models.

show_stable

A logical indicating whether or not to draw a line indicating population stability at lambda = 1.

...

Further arguments to plot.

Details

Plotting can be controlled by passing additional graphing parameters to ....

Examples

Run this code
data(gen_di_det_ex)

proto <- gen_di_det_ex$proto_ipm %>%
  define_pop_state(n_ht = runif(200),
                   n_b  = 200000)

ipm <- make_ipm(proto)

is_conv_to_asymptotic(ipm, tolerance = 1e-5)
conv_plot(ipm)

Run the code above in your browser using DataLab