projection {pop} | R Documentation |
Deterministic projection
Description
Project a population dynamic model in discrete time, recording the number of individuals in each state at each time point.
Usage
projection(dynamic, population, timesteps = 1)
is.pop_projection(x)
## S3 method for class 'pop_projection'
plot(x, states = NULL, patches = 1, ...)
Arguments
dynamic |
a population dynamic model of class |
population |
a dataframe or named vector of positive integers, giving
the number of individuals in each state of |
timesteps |
a positive integer giving the number of time steps (iterations) over which to simulate the model |
x |
a |
states |
character vector naming the states in the |
patches |
vector of positive integers identifying the patches for which to plot the projections. By default only projections for the first patch are plotted. |
... |
further arguments passed to or from other methods. |
Value
an object of class pop_projection
Examples
# set up a three-stage model
stasis_egg <- tr(egg ~ egg, p(0.6))
stasis_larva <- tr(larva ~ larva, p(0.4))
stasis_adult <- tr(adult ~ adult, p(0.9))
hatching <- tr(larva ~ egg, p(0.35))
fecundity <- tr(egg ~ adult, r(20))
pupation <- tr(adult ~ larva, p(0.2))
pd <- dynamic(stasis_egg,
stasis_larva,
stasis_adult,
hatching,
pupation,
fecundity)
population <- data.frame(egg = 1200, larva = 250, adult = 50)
# simulate for 50 timesteps, 30 times
proj <- projection(dynamic = pd,
population = population,
timesteps = 50)
is.pop_projection(proj)
par(mfrow = c(3, 1))
plot(proj)