dynamic {pop} | R Documentation |
dynamic objects
Description
creates a dynamic
object, comprising multiple
transition
objects to define a dynamical system. dynamic
objects are the core of pop
, since they can be created and updated
using various methods (MPMs, IPMs etc.), combined (by addition of two
dynamic
objects to make another) and and analysed in various ways
(deterministically to obtain demographic parameters, simulated to evaluate
population viability etc.)
Usage
dynamic(...)
is.dynamic(x)
## S3 method for class 'dynamic'
plot(x, ...)
states(x)
## S3 method for class 'dynamic'
print(x, ...)
## S3 method for class 'dynamic'
as.matrix(x, which = c("A", "P", "F", "R"), ...)
## S3 method for class 'dynamic'
parameters(x)
## S3 replacement method for class 'dynamic'
parameters(x) <- value
Arguments
x |
a dynamic object to print, plot, convert to a transition matrix, or
an object to test as a dynamic object (for |
which |
which type of matrix to build: the overall population growth
matrix ( |
value |
a nested named list of parameters within each transition
matching those currently defined for |
... |
for |
Examples
# define transitions for a simple three-stage system (with implicit
# mortality):
stasis_egg <- tr(egg ~ egg, p(0.4))
stasis_larva <- tr(larva ~ larva, p(0.3))
stasis_adult <- tr(adult ~ adult, p(0.8))
hatching <- tr(larva ~ egg, p(0.5))
fecundity <- tr(egg ~ adult, r(3))
pupation <- tr(adult ~ larva, p(0.2))
# combine these into separate dynamics
stasis <- dynamic(stasis_egg,
stasis_larva,
stasis_adult)
growth <- dynamic(hatching,
pupation)
reproduction <- dynamic(fecundity)
# combine these into one dynamic (the same as listing all the transitions
# separately)
all <- dynamic(stasis, growth, reproduction)
# plot these
plot(stasis)
plot(growth)
plot(all)
# get component states
states(all)
# print method
print(all)
# convert to a transition matrix
as.matrix(all)
# extract the parameters
(param_stasis <- parameters(stasis))
(param_all <- parameters(all))
# update the parameters of these transfuns
param_stasis$stasis_egg$p <- 0.6
parameters(stasis) <- param_stasis
parameters(stasis)
param_all$fecundity$r <- 15
parameters(all) <- param_all
parameters(all)