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.
tpmatrix(...)
Named values of expressions defining elements of the matrix. See "Details" and the example below.
Returns a tpmatrix
object that inherits from data.table
where each column is an element of the transition probability matrix with
elements ordered rowwise.
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
.
define_model()
, define_tparams()
,
tpmatrix_id()
, tparams_transprobs()
, CohortDtstmTrans()
# NOT RUN {
p <- c(.7, .6)
tpmatrix(
C, p,
0, 1
)
# }
Run the code above in your browser using DataLab