# Create transition matrix

Source: `R/model-setup.R`
`create_trans_mat.Rd`

Create a transition matrix describing patient transitions between health states.

    create_trans_mat(object)

## Arguments

object | A `model_structure` object.

## Value

A transition matrix of the same format as in the mstate package.

## Examples

    txseq1 <- txseq(first = "erlotinib",
                   second = c("osimertinib", "PBDC"),
                   second_plus = c("PBDC + bevacizumab", "PBDC + bevacizumab"))
    txseq2 <- txseq(first = "gefitinib",
                   second = c("osimertinib", "PBDC"),
                   second_plus = c("PBDC + bevacizumab", "PBDC + bevacizumab"))
    txseqs <- txseq_list(seq1 = txseq1, seq2 = txseq2)

    struct1 <- model_structure(txseqs, n_states = "four")
    create_trans_mat(struct1)#>       S1 P1/S2 P2  D
    #> S1    NA     1 NA  2
    #> P1/S2 NA    NA  3  4
    #> P2    NA    NA NA  5
    #> D     NA    NA NA NA
    struct2 <- model_structure(txseqs, n_states = "three")
    create_trans_mat(struct2)#>       S1 P1/S2  D
    #> S1    NA     1  2
    #> P1/S2 NA    NA  3
    #> D     NA    NA NA
    txseqs <- txseq_list(seq1 = txseq1, seq2 = txseq2,
                         start_line = "second", mutation = "positive")
    struct3 <- model_structure(txseqs, n_states = "three")
    create_trans_mat(struct3)#>       P1/S2 P2  D
    #> P1/S2    NA  1  2
    #> P2       NA NA  3
    #> D        NA NA NA