Learn R Programming

primer (version 0.1)

predpreyLV: The Lotka-Volterra predator-prey model

Description

The Lotka-Volterra predator-prey model, for use with ode in the deSolve package.

Usage

predpreyLV(t, y, params)

Arguments

t
Argument for time
y
A vector of length 2, for population 1 and 2
params
Vector or list of parameters

Value

  • Returns a list of length one, for use with ode in the deSolve package.
  • Component 1vector of the state variables, y.

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

predpreyRM

Examples

Run this code
params1 <- c(b=.5, a=.01, s=.2, e=.1) 
Time <- seq(0,100, by=.1) # Set time here
LV.out <- ode(c(H0=25,P0=5), Time, predpreyLV, params1)
matplot(Time, (LV.out[,2:3]), type="l", ylab="Population Size")

Run the code above in your browser using DataLab