View source: R/predator_prey_dynamics.R
run_predprey_model | R Documentation |
Run predator-prey model
run_predprey_model(time, init, params)
time |
vector of time units over which to run model, starting from 0.
|
init |
vector of initial population sizes for both species, with names H and P |
params |
vector of parameters. If the param vector has entries of c(r, a, e, d), the function runs the classic Lotka-Volterra model (type 1 functional response of predator; exponential growth for prey). If the parameter vector has entries c(r, a, e, d, K), supplied, then the function runs the Lotka-Volterra model with logistic growth in the prey. If the parameter vector has entries c(r, a, e, d, T_h), the function runs the Lotka-Volterra model with a Type II function response in the predator. Finally, if the parameter vector has entries c(r, a, e, d, K, T_h), the function runs the Lotka-Volterra model with logistic growth in the prey and Type II functional response for the predator (this is sometimes called the Rosenzweig-Macarthur model). |
plot_predprey_time()
for plots of the population dynamics over
time, and plot_predprey_portrait()
for making portrait plots of the
predator and prey (including visualizations of the ZNGIs)
# Lotka-Volterra predator-prey model
params_lv <- c(r = .1, a = .01, e = .01, d = .001)
head(run_predprey_model(5, init = c(H = 10, P = 5), params = params_lv))
# Lotka-Volterra model with logistic growth of prey
params_lv_logprey <- c(r = .1, a = .01, e = .01, d = .001, K = 1000)
head(run_predprey_model(5, init = c(H = 10, P = 5), params = params_lv_logprey))
# Lotka-Volterra model with Type 2 functional response
params_lvt2 <- c(r = .1, a = .01, e = .01, d = .001, T_h = .1)
head(run_predprey_model(5, init = c(H = 10, P = 5), params = params_lvt2))
# Rosenzweig-Macarthur model (logistic prey and Type 2 FR predator)
params_rm <- c(r = .1, a = .01, e = .01, d = .001, K = 1000, T_h = .1)
head(run_predprey_model(5, init = c(H = 10, P = 5), params = params_rm))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.