generate_logistic_data: Generate Example Logistic Growth Time-Series Data

Description Usage Arguments Value

View source: R/generate_logistic_data.R

Description

Generate Example Logistic Growth Time-Series Data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
generate_logistic_data(
  P0,
  K = 1,
  r,
  max_t,
  time_step,
  noise = 0,
  method = "analytic",
  make_plot = FALSE
)

Arguments

P0

Positive numeric; the initial population value.

K

Positive numeric; the carrying capacity. Defaults to 1, which is the value to use if the model is dimensionless/relative.

r

Positive numeric; the intrinsic population growth rate.

max_t

Positive numeric; the maximum time step at which to evaluate the model (note that the minimum time step is always 0).

time_step

Positive numeric; the size of steps to take between each evaluation of the model. The vector of times will be generated as a sequence from 0 to max_t in step-size of this parameter.

noise

Positive numeric; the amount of noise to add to the data, as a proportion of the equilibrium value. E.g. setting this to some "s" will add a normal random vector of noise to the data where all entries are drawn from the normal distribution with mean 0 and sd s*K. If you have an sd that you want to add manually, you will have to do the algebra to get it as a proportion of K.

method

Character; chosen from "analytic" ("a"), "discretized" ("d"), or "RK4" ("r"), which determines which method to use to generate the data.

make_plot

Logical; if true, the function will generate a plot of the generated time series for you.

Value

a data frame with columns "t", the time values at which the model was evaluated, and "P", the population size at each time step.


wz-billings/HMBGR documentation built on May 15, 2020, 5:44 a.m.