Learn R Programming

primer (version 1.2.0)

lvcompg: A General Lotka-Volterra Competition Model

Description

A general Lotka-Volterra competition model, for any number of species. For use with ode in the deSolve package. This function uses a vector and matrix within the list of parameters.

Usage

lvcompg(t, n, parms)

Arguments

t

the time point for a realization of the integration.

n

the vector of populations, at each time t.

parms

a LIST containing a vector of growth rates (r), and a matrix of interaction coefficients (a).

Value

Returns a list of length one which is the vector of the rates of increase (required by ode).

References

Lotka, A.J. (1956) Elements of Mathematical Biology. Dover Publications, Inc.

Stevens, M.H.H. (2009) A Primer of Ecology with R. Use R! Series. Springer.

See Also

lvcomp3, clogistic, igp, scheffer

Examples

Run this code
# NOT RUN {
## Specify the number of species
S <- 10
alpha <- .01
r <- runif(S)*2
a <- matrix(rnorm(S^2, m=alpha, sd=alpha/10), nrow=S, ncol=S)
parms <- list(r,a)
t=seq(0,40, by=.1)
N0 <- runif(S)/(S*alpha)
library(deSolve)
lvout <- ode(N0, t, lvcompg, parms)
matplot(t, lvout[,-1], type="l", ylab="N", log='y')

# }

Run the code above in your browser using DataLab