Learn R Programming

hesim (version 0.5.0)

tpmatrix_names: Names for elements of a transition probability matrix

Description

Create names for all elements of a transition probability matrix given names for the health states. This is useful for flattening a transition probability matrix (rowwise) into a vector and naming the resulting vector. The name of an element of the flattened vector representing a transition from the ith state to the jth state is of the form paste0(prefix, state_i, sep, state_j).

Usage

tpmatrix_names(states, prefix = "p_", sep = "_")

Arguments

states

A character vector of the names of health states in the transition matrix.

prefix

A prefix that precedes the described transitions between states.

sep

A character string to separate the terms representing state i and state j.

Value

A character vector containing a name for each element of the transition probability matrix encompassing all possible transitions.

Examples

Run this code
# NOT RUN {
tpmatrix_names(LETTERS[1:4])
tpmatrix_names(LETTERS[1:4], prefix = "")
tpmatrix_names(LETTERS[1:4], prefix = "", sep = ".")

# }

Run the code above in your browser using DataLab