[R] Predator Prey Models

Ben Bolker bbolker at gmail.com
Sun Dec 12 03:36:11 CET 2010


Craig O'Connell <craigpoconnell <at> gmail.com> writes:

>    I am currently modifying a previously developed predator prey model and
> was curious if there was a way to add in a disturbance to the model (let's
> say at time t=100).  The disturbance can be the introduction of 40 prey
> (N=40) and 10 predators (Pred = 10).  I would like to see my model go from a
> state of equilibrium (up to t = 99), show this disturbance (at t = 100) and
> then slowly work its way back to equilibrium.  Does anybody know if this
> could be done?

library(deSolve)
?events

lsoda(...,
  events=list(data=data.frame(var=c("N","Pred"),time=rep(100,2),
                  value=c(40,10),method=rep("add",2))))

or something like that ...



More information about the R-help mailing list