Learn R Programming

hesim (version 0.5.0)

qmatrix.matrix: Transition intensity matrix from tabular object

Description

Creates transition intensity matrices where elements represent the instantaneous risk of moving between health states.

Usage

# S3 method for matrix
qmatrix(x, trans_mat, ...)

# S3 method for data.table qmatrix(x, trans_mat, ...)

# S3 method for data.frame qmatrix(x, trans_mat, ...)

Arguments

x

A two-dimensional tabular object containing elements of the transition intensity matrix. A column represents a transition from state \(r\) to state \(s\). Each row represents elements of a different transition intensity matrix. See "Details" for more information.

trans_mat

Just as in IndivCtstmTrans, a transition matrix describing the states and transitions in a multi-state model.

...

Further arguments passed to or from other methods. Currently unused.

Value

An array of transition intensity matrices with the third dimension equal to the number of rows in x.

Details

The object x must only contain non-zero and non-diagonal elements of a transition intensity matrix. The diagonal elements are automatically computed as the negative sum of the other rows.

See Also

qmatrix.msm()

Examples

Run this code
# NOT RUN {
# 3 state irreversible model
tmat <- rbind(c(NA, 1, 2),
              c(NA, NA, 3),
              c(NA, NA, NA)) 
q12 <- c(.8, .7)
q13 <- c(.2, .3)
q23 <- c(1.1, 1.2)
q <- data.frame(q12, q13, q23)
qmat <- qmatrix(q, trans_mat = tmat)
print(qmat)

# Matrix exponential of each matrix in array
expmat(qmat)

# }

Run the code above in your browser using DataLab