transition: transition objects

Description Usage Arguments Details Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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 transfun object quantifying the transition.

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 x

...

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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)

goldingn/pop documentation built on May 17, 2019, 7:42 a.m.