Learn R Programming

primer (version 0.1)

dlvcomp2: Discrete Logistic Growth

Description

A function to simulate discrete 2 species Lotka-Volterra growth.

Usage

dlvcomp2(N, alpha, rd = c(1, 1))

Arguments

N
a vector of length two, containing N[t] for both species.
alpha
a 2 x 2 matrix of the magnitudes of the per capita (negative) effects (i.e., positive value results in a negative effect).
rd
a vector of length 2 containing the discrete growth increments for 2 species.

Value

  • Returns a vector of length 2, containing N[t+1] for both species.

References

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

See Also

dlogistic, lvcomp2, lvcomp3

Examples

Run this code
alphs <- matrix(c( .01, .005,
                  .008, .01), ncol=2, byrow=TRUE)
t <- 20
N <- matrix(NA, nrow=t+1, ncol=2)
N[1,] <- c(10,10)
for(i in 1:t) N[i+1,] <- dlvcomp2(N[i,], alphs)
matplot(0:t, N, type='l', col=1, ylim=c(0,110))
abline(h=1/alphs[1,1], lty=3)
text(0, 1/alphs[1,1], "K", adj=c(0,0))
legend("right", c(expression("Sp.1 "*(alpha[21]==0.008)), 
                  expression("Sp.2 "*(alpha[12]==0.005))), lty=1:2, bty='n')

Run the code above in your browser using DataLab