Learn R Programming

mstate (version 0.3.3)

transhelp: Help functions for transition matrix

Description

Help functions to get insight into the structure of a transition matrix.

Value

See details.

Arguments

trans

Transition matrix, for instance produced by transMat), trans.comprisk, or trans.illdeath

Author

Hein Putter <H.Putter@lumc.nl>

Details

Function to.trans2 simply lists the transitions in trans in a data frame; function trans2Q converts trans to a Q matrix, the (j,k)th element of which contains the (shortest) number of transitions needed to travel from the jth to the kth state; function absorbing returns a vector (named if trans contains row or columnc names) with the state numbers that are absorbing; function is.circular returns (a Boolean) whether the transition matrix specified in trans is circular or not.

Examples

Run this code

# Irreversible illness-death model
tmat <- trans.illdeath(c("Healthy", "Illness", "Death"))
tmat
to.trans2(tmat)
trans2Q(tmat)
absorbing(tmat)
is.circular(tmat)
# Reversible illness-death model
tmat <- transMat(x = list( c(2, 3), c(1, 3), c() ),
                 names = c("Healthy", "Illness", "Death"))
tmat
to.trans2(tmat)
trans2Q(tmat)
absorbing(tmat)
is.circular(tmat)

Run the code above in your browser using DataLab