# lvcompg: A General Lotka-Volterra Competition Model In primer: Functions and data for A Primer of Ecology with R

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

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

## Author(s)

Hank Stevens <[email protected]>

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

`lvcomp3`, `clogistic`, `igp`, `scheffer`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```## 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') ```

### Example output

```Loading required package: deSolve