qmatrix.matrix: Transition intensity matrix from tabular object

View source: R/tpmatrix.R

qmatrix.matrixR Documentation

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 class 'matrix'
qmatrix(x, trans_mat, ...)

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

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

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.

Value

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

See Also

qmatrix.msm()

Examples

# 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)


dincerti/cea documentation built on Feb. 16, 2024, 1:15 p.m.