lvcompg {primer} | R Documentation |
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.
lvcompg(t, n, parms)
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). |
Returns a list of length one which is the vector of the rates of increase (required by ode
).
Hank Stevens <HStevens@muohio.edu>
A.J. Lotka. Elements of Mathematical Biology. Dover Publications, Inc., 1956.
M.H.H. Stevens. A Primer of Ecology with R. Use R! Series. Springer, 2009.
## 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')