Learn R Programming

primer (version 0.1)

levins: Classic metapopulation model

Description

A function for the classic metaapopulation dynamics, for use with ode in the deSolve package.

Usage

levins(t, y, parms)

Arguments

t
Argument for time
y
A scalar for the population variable
parms
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 variable (a scalar for the proportion of sites occupied).

References

R. Levins. Some demographic and genetic consequences of environmental heterogeneity for biological control. Bulletin of the Entomological Society of America, 15:237--240, 1969.

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

See Also

gotelli, hanski,lande, MetaSim clogistic

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (t, y, parms) 
{
    p <- y[1]
    with(as.list(parms), {
        dp <- ci * p * (1 - p) - e * p
        return(list(dp))
    })
  }
library(deSolve)
p <- c(ci=.1, e=.01)
time <- 1:10
initialN <- .3
out <- ode(y=initialN, times=time, func=levins, parms=p) 
plot(time, out[,-1], type='l')

Run the code above in your browser using DataLab