View source: R/1_model_functions.R
populate_transition_matrix | R Documentation |
Populate transition matrix
populate_transition_matrix(no_states, tmat, list_prob, name_states = NULL)
no_states |
number of the health states |
tmat |
A transition matrix in the format from the package 'mstate' |
list_prob |
list of probabilities as in the order of transitions (row wise) |
name_states |
names of the health states |
If the state names are null, they are replaced with numbers starting from 1 First find those missing probabilities, and fill a list from the given list of probabilities and fill those are not NA in the matrix Note that the probabilities need not be numeric here and no checks are needed for sum
value of the transition matrix
tmat <- rbind(c(1, 2), c(3, 4))
colnames(tmat) <- rownames(tmat) <- c("Healthy", "Dead")
populate_transition_matrix(2, tmat, list_prob = c(0.2, 0.5, 0, 0.3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.