View source: R/lotka_volterra_competition.R
run_lvcomp_model | R Documentation |
Given a vector of time, intiial values, and parameters, this function runs the Lotka-Volterra competition model. Note that the competition parameters can either be given as the relative effects of one species on the other (in terms of alpha (a) and beta (b)), or in terms of the absolute intraspecific and interspecific competition coefficients (a11, a12, a22, a21).
run_lvcomp_model(
time = 0:100,
init = c(N1 = 20, N2 = 15),
params = c(r1 = 0.15, r2 = 0.2, K1 = 1000, K2 = 800, a = 0.9, b = 1.05)
)
time |
vector of time units over which to run model, starting from 0.
|
init |
vector of initial population sizes for both species, with names N1 and N2 |
params |
vector of model parameters Note that carrying capacity for both
species can be defined in |
plot_lvcomp_time()
for making a plot of population dynamics over
time, and plot_lvcomp_portrait()
for making a phase portrait of the both
species (including the ZNGIs) the ZNGIs)
# Define full time series, and run model in terms of carrying capacities
# and relative competitive effects
run_lvcomp_model(time = 0:5, init = c(N1 = 1, N2 = 5),
params = c(r1 = .15, r2 = .2, K1 = 1000, K2 = 800, a = 0.9, b = 1.05))
# Run model in terms of absolute competition coefficients
# (i.e. a11, a12, a21, a22)
run_lvcomp_model(time = 0:5, init = c(N1 = 1, N2 = 5),
params = c(r1 = .15, r2 = .2, a11 = .001, a22 = 0.00125, a12 = .0005, a21 = .0007))
# Give only the final time step rather than full time series
run_lvcomp_model(time = 0:5, init = c(N1 = 1, N2 = 5),
params = c(r1 = .15, r2 = .2, K1 = 1000, K2 = 800, a = 0.9, b = 1.05))
run_lvcomp_model(time = 0:5, init = c(N1 = 1, N2 = 5),
params = c(r1 = .15, r2 = .2, a11 = .001, a22 = 0.00125, a12 = .0005, a21 = .0007))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.