Skip to contents

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).

Usage

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)
)

Arguments

time

vector of time units over which to run model, starting from 0. time can also be supplied as just the total length of the simulation (i.e. tmax)

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 params either as K1 and K2, or in the inverse, as a11 and a22. If carrying capacities are defined as K1 and K2, interspecific competition should be defined as a and b; otherwise, a12 and a21.

See also

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)

Examples

# 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))
#>   time       N1        N2
#> 1    0 1.000000  5.000000
#> 2    1 1.160779  6.096851
#> 3    2 1.347153  7.431729
#> 4    3 1.563093  9.055053
#> 5    4 1.813144 11.027352
#> 6    5 2.102494 13.420985

# 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))
#>   time       N1        N2
#> 1    0 1.000000  5.000000
#> 2    1 1.161165  6.097656
#> 3    2 1.348145  7.433846
#> 4    3 1.565015  9.059236
#> 5    4 1.816463 11.034704
#> 6    5 2.107880 13.433107

# 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))
#>   time       N1        N2
#> 1    0 1.000000  5.000000
#> 2    1 1.160779  6.096851
#> 3    2 1.347153  7.431729
#> 4    3 1.563093  9.055053
#> 5    4 1.813144 11.027352
#> 6    5 2.102494 13.420985
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))
#>   time       N1        N2
#> 1    0 1.000000  5.000000
#> 2    1 1.161165  6.097656
#> 3    2 1.348145  7.433846
#> 4    3 1.565015  9.059236
#> 5    4 1.816463 11.034704
#> 6    5 2.107880 13.433107