transition {pop} | R Documentation |
transition objects
Description
creates a transition
object, encoding a transition
between two states. E.g. the probability of a seed germinating, or of an
individual surviving in each time step
Usage
transition(formula, transfun)
tr(formula, transfun)
is.transition(x)
## S3 method for class 'transition'
print(x, ...)
## S3 method for class 'transition'
x * y
## S3 method for class 'transition'
parameters(x)
## S3 replacement method for class 'transition'
parameters(x) <- value
Arguments
formula |
a two-sided formula identifying the states between which the transition occurs |
transfun |
a |
x |
an object to print or test as a transition object |
y |
a transition object to be multiplied with another with the same pathway |
value |
a named list of parameters matching those currently defined for |
... |
further arguments passed to or from other methods. |
Details
tr
is just a shorthand for transition
multiplication of transition objects with the same pathway results
in a transition object whose transfun
object is a compound of the
two transfuns in the transitions. See transfun
for more
details of compound transfuns.
Examples
# 50/50 chance of a larva emerging from an egg
hatching <- tr(larva ~ egg, p(0.5))
# three eggs laid per adult per time step
fecundity <- tr(egg ~ adult, r(3))
# 0.1 probability of a larva pupating into an adult
pupa <- tr(adult ~ larva, p(0.1))
# print method
print(pupa)
# make a compound transition to include a probability of laying eggs
prob_laying <- tr(egg ~ adult, p(0.6))
(recruitment <- prob_laying * fecundity)
# extract the transfun parameters
(param_pupa <- parameters(pupa))
(param_recruitment <- parameters(recruitment))
# update the parameters of these transfuns
param_pupa$p <- 0.6
parameters(pupa) <- param_pupa
parameters(pupa)
param_recruitment$r <- 15
parameters(recruitment) <- param_recruitment
parameters(recruitment)