Learn R Programming

pop (version 0.1)

transfun: transfun objects

Description

utility functions for the transfun class. transfun objects are created by functions such as probability.

Usage

is.transfun(x)
"print"(x, ...)
"*"(x, y)
"parameters"(x)
"parameters"(x) <- value

Arguments

x
a transfun object to print or an object to test as a transfun object
y
a transfun 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

multiplication of transfun objects with the same pathway results in a compound transfun object (also of class transfun). When used in a stochastic model, the two stochastic transitions are evaluated one after another. When analysed deterministically, the expectation of the compound transition function is taken as the product of the expectations of the two basis transfuns.

Examples

Run this code
prob <- p(0.3)
is.transfun(prob)

prob
(compound <- prob * r(4.3))

# extract the transfun parameters
(param_prob <- parameters(prob))
(param_compound <- parameters(compound))

# update the parameters of these transfuns
param_prob$p <- 0.6
parameters(prob) <- param_prob
parameters(prob)

param_compound$r <- 15
parameters(compound) <- param_compound
parameters(compound)

Run the code above in your browser using DataLab