Learn R Programming

hesim (version 0.4.1)

tpmatrix: Transition probability matrix

Description

tpmatrix() both defines and evaluates a transition probability matrix in which elements are expressions. It can be used within define_tparams() to create a transition probability matrix or directly to create a tparams_transprobs() object. These are, in turn, ultimately used to create a CohortDtstmTrans object for simulating health state transitions.

Usage

tpmatrix(...)

Arguments

...

Named values of expressions defining elements of the matrix. See "Details" and the example below.

Value

Returns a tpmatrix object that inherits from data.table where each column is an element of the transition probability matrix with elements ordered rowwise.

Details

The matrix is filled rowwise, meaning that each row should sum to 1. The complementary probability (equal to 1 minus the sum of the probabilities of all other rows) can be conveniently referred to as C.

See Also

define_model(), define_tparams(), tpmatrix_id(), tparams_transprobs(), CohortDtstmTrans()

Examples

Run this code
# NOT RUN {
p <- c(.7, .6)
tpmatrix(
  C, p,
  0, 1
)
# }

Run the code above in your browser using DataLab