transfun objects

Share:

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
is.transfun(x)

## S3 method for class 'transfun'
print(x, ...)

## S3 method for class 'transfun'
x * y

## S3 method for class 'transfun'
parameters(x)

## S3 replacement method for class 'transfun'
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)