Error in `(function (death_rate, retirement_rate, excess_mortality, increased_relapse_1, increased_relapse_2, increased_relapse_3, increased_relapse_4, increased_relapse_5, mean_dur_chron, leavemodel, incidence_no_history, pmild, pmoderate, psevere, mildrecovery, mildpartial, mildchronic, moderaterecovery, moderatepartial, moderatechronic, severerecovery, severepartial, severechronic, mildrecoverycured, mildrecoveryrelapse, mildpartialcured, mildpartialrelapse, moderaterecoveryrelapse, moderaterecoverycured,      moderatepartialcured, moderatepartialrelapse, severerecoverycured, severerecoveryrelapse, severepartialcured, severepartialrelapse)  {     transition_matrix <- array(0, dim = c(length(states), length(states), 47), dimnames = list(from = states, to = states, year = 0:46))     transition_matrix["mild_incidence", "mild_incidence", ] <- 1     transition_matrix["mild_incidence", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - mildrecoveryrelapse * relapsecure) + pmild * mildpartial * (1 - mildpartialrelapse * relapsecure)))     transition_matrix["mild_incidence", "mild_1x_1_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * mildrecoveryrelapse + pmild * mildpartial * mildpartialrelapse)) * 0.4     transition_matrix["mild_incidence", "mild_1x_2_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * mildrecoveryrelapse + pmild * mildpartial * mildpartialrelapse)) * 0.3     transition_matrix["mild_incidence", "mild_1x_3_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * mildrecoveryrelapse + pmild * mildpartial * mildpartialrelapse)) * 0.2     transition_matrix["mild_incidence", "mild_1x_4_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * mildrecoveryrelapse + pmild * mildpartial * mildpartialrelapse)) * 0.07     transition_matrix["mild_incidence", "mild_1x_5_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * mildrecoveryrelapse + pmild * mildpartial * mildpartialrelapse)) * 0.03     transition_matrix["mild_incidence", "mild_chronic", ] <- leavemodel/pmild * ((pmild * mildchronic))     transition_matrix["mild_incidence", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_incidence", "moderate_incidence", ] <- 1     transition_matrix["moderate_incidence", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - moderaterecoveryrelapse * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - moderatepartialrelapse * relapsecure * moderatecure)))     transition_matrix["moderate_incidence", "moderate_1x_1_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * moderaterecoveryrelapse * moderatecure + pmoderate * moderatepartial * moderatepartialrelapse * moderatecure)) * 0.4     transition_matrix["moderate_incidence", "moderate_1x_2_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * moderaterecoveryrelapse * moderatecure + pmoderate * moderatepartial * moderatepartialrelapse * moderatecure)) * 0.3     transition_matrix["moderate_incidence", "moderate_1x_3_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * moderaterecoveryrelapse * moderatecure + pmoderate * moderatepartial * moderatepartialrelapse * moderatecure)) * 0.2     transition_matrix["moderate_incidence", "moderate_1x_4_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * moderaterecoveryrelapse * moderatecure + pmoderate * moderatepartial * moderatepartialrelapse * moderatecure)) * 0.07     transition_matrix["moderate_incidence", "moderate_1x_5_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * moderaterecoveryrelapse * moderatecure + pmoderate * moderatepartial * moderatepartialrelapse * moderatecure)) * 0.03     transition_matrix["moderate_incidence", "moderate_chronic", ] <- leavemodel/pmoderate * ((pmoderate * moderatechronic))     transition_matrix["moderate_incidence", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_incidence", "severe_incidence", ] <- 1     transition_matrix["severe_incidence", "severe_cured", ] <- leavemodel/psevere * ((psevere * severerecovery * (1 - severerecoveryrelapse * relapsecure * severecure) + psevere * severepartial * (1 - severepartialrelapse * relapsecure * severecure)))     transition_matrix["severe_incidence", "severe_1x_1_year", ] <- leavemodel/psevere * (relapsecure * (psevere * severerecovery * severerecoveryrelapse * severecure + psevere * severepartial * severepartialrelapse * severecure)) * 0.4     transition_matrix["severe_incidence", "severe_1x_2_year", ] <- leavemodel/psevere * (relapsecure * (psevere * severerecovery * severerecoveryrelapse * severecure + psevere * severepartial * severepartialrelapse * severecure)) * 0.3     transition_matrix["severe_incidence", "severe_1x_3_year", ] <- leavemodel/psevere * (relapsecure * (psevere * severerecovery * severerecoveryrelapse * severecure + psevere * severepartial * severepartialrelapse * severecure)) * 0.2     transition_matrix["severe_incidence", "severe_1x_4_year", ] <- leavemodel/psevere * (relapsecure * (psevere * severerecovery * severerecoveryrelapse * severecure + psevere * severepartial * severepartialrelapse * severecure)) * 0.07     transition_matrix["severe_incidence", "severe_1x_5_year", ] <- leavemodel/psevere * (relapsecure * (psevere * severerecovery * severerecoveryrelapse * severecure + psevere * severepartial * severepartialrelapse * severecure)) * 0.03     transition_matrix["severe_incidence", "severe_chronic", ] <- leavemodel/psevere * ((psevere * severechronic))     transition_matrix["severe_incidence", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_cured", "mild_cured", ] <- leavemodel     transition_matrix["mild_cured", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_cured", "moderate_cured", ] <- leavemodel     transition_matrix["moderate_cured", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_cured", "severe_cured", ] <- leavemodel     transition_matrix["severe_cured", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_1x_1_year", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_1))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_1))) * relapsecure)))     transition_matrix["mild_1x_1_year", "mild_2x_1_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_1))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_1))))) * 0.4     transition_matrix["mild_1x_1_year", "mild_2x_2_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_1))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_1))))) * 0.3     transition_matrix["mild_1x_1_year", "mild_2x_3_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_1))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_1))))) * 0.2     transition_matrix["mild_1x_1_year", "mild_2x_4_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_1))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_1))))) * 0.07     transition_matrix["mild_1x_1_year", "mild_2x_5_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_1))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_1))))) * 0.03     transition_matrix["mild_1x_1_year", "mild_chronic", ] <- leavemodel/pmild * ((pmild * mildchronic))     transition_matrix["mild_1x_1_year", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_1x_1_year", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_1))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_1))) * relapsecure * moderatecure)))     transition_matrix["moderate_1x_1_year", "moderate_2x_1_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_1))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_1))))) * 0.4     transition_matrix["moderate_1x_1_year", "moderate_2x_2_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_1))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_1))))) * 0.3     transition_matrix["moderate_1x_1_year", "moderate_2x_3_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_1))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_1))))) * 0.2     transition_matrix["moderate_1x_1_year", "moderate_2x_4_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_1))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_1))))) * 0.07     transition_matrix["moderate_1x_1_year", "moderate_2x_5_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_1))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_1))))) * 0.03     transition_matrix["moderate_1x_1_year", "moderate_chronic", ] <- leavemodel/pmoderate * ((pmoderate * moderatechronic))     transition_matrix["moderate_1x_1_year", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_1x_1_year", "severe_cured", ] <- leavemodel/psevere * ((psevere * severerecovery * (1 - (1 - (severerecoverycured * (1 - increased_relapse_1))) * relapsecure * severecure) + psevere * severepartial * (1 - (1 - (severepartialcured * (1 - increased_relapse_1))) * relapsecure * severecure)))     transition_matrix["severe_1x_1_year", "severe_2x_1_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_1))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_1))) * severecure)) * 0.4     transition_matrix["severe_1x_1_year", "severe_2x_2_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_1))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_1))) * severecure)) * 0.3     transition_matrix["severe_1x_1_year", "severe_2x_3_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_1))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_1))) * severecure)) * 0.2     transition_matrix["severe_1x_1_year", "severe_2x_4_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_1))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_1))) * severecure)) * 0.07     transition_matrix["severe_1x_1_year", "severe_2x_5_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_1))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_1))) * severecure)) * 0.03     transition_matrix["severe_1x_1_year", "severe_chronic", ] <- leavemodel/psevere * ((psevere * severechronic))     transition_matrix["severe_1x_1_year", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_1x_2_year", "mild_1x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_2_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_2_year", "moderate_1x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_2_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_2_year", "severe_1x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_2_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_3_year", "mild_1x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_3_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_3_year", "moderate_1x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_3_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_3_year", "severe_1x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_3_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_4_year", "mild_1x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_4_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_4_year", "moderate_1x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_4_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_4_year", "severe_1x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_4_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_5_year", "mild_1x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_1x_5_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_5_year", "moderate_1x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_1x_5_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_5_year", "severe_1x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_1x_5_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_1_year", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_2))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_2))) * relapsecure)))     transition_matrix["mild_2x_1_year", "mild_3x_1_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_2))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_2))))) * 0.4     transition_matrix["mild_2x_1_year", "mild_3x_2_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_2))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_2))))) * 0.3     transition_matrix["mild_2x_1_year", "mild_3x_3_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_2))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_2))))) * 0.2     transition_matrix["mild_2x_1_year", "mild_3x_4_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_2))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_2))))) * 0.07     transition_matrix["mild_2x_1_year", "mild_3x_5_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_2))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_2))))) * 0.03     transition_matrix["mild_2x_1_year", "mild_chronic", ] <- leavemodel/pmild * ((pmild * mildchronic))     transition_matrix["mild_2x_1_year", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_2x_1_year", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_2))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_2))) * relapsecure * moderatecure)))     transition_matrix["moderate_2x_1_year", "moderate_3x_1_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_2))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_2))))) * 0.4     transition_matrix["moderate_2x_1_year", "moderate_3x_2_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_2))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_2))))) * 0.3     transition_matrix["moderate_2x_1_year", "moderate_3x_3_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_2))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_2))))) * 0.2     transition_matrix["moderate_2x_1_year", "moderate_3x_4_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_2))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_2))))) * 0.07     transition_matrix["moderate_2x_1_year", "moderate_3x_5_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_2))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_2))))) * 0.03     transition_matrix["moderate_2x_1_year", "moderate_chronic", ] <- leavemodel/pmoderate * ((pmoderate * moderatechronic))     transition_matrix["moderate_2x_1_year", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_2x_1_year", "severe_cured", ] <- leavemodel/psevere * ((psevere * severerecovery * (1 - (1 - (severerecoverycured * (1 - increased_relapse_2))) * relapsecure * severecure) + psevere * severepartial * (1 - (1 - (severepartialcured * (1 - increased_relapse_2))) * relapsecure * severecure)))     transition_matrix["severe_2x_1_year", "severe_3x_1_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_2))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_2))) * severecure)) * 0.4     transition_matrix["severe_2x_1_year", "severe_3x_2_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_2))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_2))) * severecure)) * 0.3     transition_matrix["severe_2x_1_year", "severe_3x_3_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_2))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_2))) * severecure)) * 0.2     transition_matrix["severe_2x_1_year", "severe_3x_4_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_2))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_2))) * severecure)) * 0.07     transition_matrix["severe_2x_1_year", "severe_3x_5_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_2))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_2))) * severecure)) * 0.03     transition_matrix["severe_2x_1_year", "severe_chronic", ] <- leavemodel/psevere * ((psevere * severechronic))     transition_matrix["severe_2x_1_year", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_2x_2_year", "mild_2x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_2_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_2_year", "moderate_2x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_2_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_2_year", "severe_2x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_2_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_3_year", "mild_2x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_3_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_3_year", "moderate_2x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_3_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_3_year", "severe_2x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_3_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_4_year", "mild_2x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_4_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_4_year", "moderate_2x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_4_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_4_year", "severe_2x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_4_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_5_year", "mild_2x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_2x_5_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_5_year", "moderate_2x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_2x_5_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_5_year", "severe_2x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_2x_5_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_1_year", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_3))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_3))) * relapsecure)))     transition_matrix["mild_3x_1_year", "mild_4x_1_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_3))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_3))))) * 0.4     transition_matrix["mild_3x_1_year", "mild_4x_2_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_3))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_3))))) * 0.3     transition_matrix["mild_3x_1_year", "mild_4x_3_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_3))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_3))))) * 0.2     transition_matrix["mild_3x_1_year", "mild_4x_4_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_3))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_3))))) * 0.07     transition_matrix["mild_3x_1_year", "mild_4x_5_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_3))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_3))))) * 0.03     transition_matrix["mild_3x_1_year", "mild_chronic", ] <- leavemodel/pmild * ((pmild * mildchronic))     transition_matrix["mild_3x_1_year", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_3x_1_year", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_3))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_3))) * relapsecure * moderatecure)))     transition_matrix["moderate_3x_1_year", "moderate_4x_1_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_3))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_3))))) * 0.4     transition_matrix["moderate_3x_1_year", "moderate_4x_2_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_3))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_3))))) * 0.3     transition_matrix["moderate_3x_1_year", "moderate_4x_3_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_3))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_3))))) * 0.2     transition_matrix["moderate_3x_1_year", "moderate_4x_4_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_3))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_3))))) * 0.07     transition_matrix["moderate_3x_1_year", "moderate_4x_5_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_3))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_3))))) * 0.03     transition_matrix["moderate_3x_1_year", "moderate_chronic", ] <- leavemodel/pmoderate * ((pmoderate * moderatechronic))     transition_matrix["moderate_3x_1_year", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_3x_1_year", "severe_cured", ] <- leavemodel/psevere * ((psevere * severerecovery * (1 - (1 - (severerecoverycured * (1 - increased_relapse_3))) * relapsecure * severecure) + psevere * severepartial * (1 - (1 - (severepartialcured * (1 - increased_relapse_3))) * relapsecure * severecure)))     transition_matrix["severe_3x_1_year", "severe_4x_1_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_3))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_3))) * severecure)) * 0.4     transition_matrix["severe_3x_1_year", "severe_4x_2_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_3))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_3))) * severecure)) * 0.3     transition_matrix["severe_3x_1_year", "severe_4x_3_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_3))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_3))) * severecure)) * 0.2     transition_matrix["severe_3x_1_year", "severe_4x_4_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_3))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_3))) * severecure)) * 0.07     transition_matrix["severe_3x_1_year", "severe_4x_5_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_3))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_3))) * severecure)) * 0.03     transition_matrix["severe_3x_1_year", "severe_chronic", ] <- leavemodel/psevere * ((psevere * severechronic))     transition_matrix["severe_3x_1_year", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_3x_2_year", "mild_3x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_2_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_2_year", "moderate_3x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_2_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_2_year", "severe_3x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_2_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_3_year", "mild_3x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_3_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_3_year", "moderate_3x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_3_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_3_year", "severe_3x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_3_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_4_year", "mild_3x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_4_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_4_year", "moderate_3x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_4_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_4_year", "severe_3x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_4_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_5_year", "mild_3x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_3x_5_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_5_year", "moderate_3x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_3x_5_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_5_year", "severe_3x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_3x_5_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_1_year", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_4))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_4))) * relapsecure)))     transition_matrix["mild_4x_1_year", "mild_5x_1_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_4))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_4))))) * 0.4     transition_matrix["mild_4x_1_year", "mild_5x_2_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_4))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_4))))) * 0.3     transition_matrix["mild_4x_1_year", "mild_5x_3_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_4))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_4))))) * 0.2     transition_matrix["mild_4x_1_year", "mild_5x_4_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_4))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_4))))) * 0.07     transition_matrix["mild_4x_1_year", "mild_5x_5_year", ] <- leavemodel/pmild * (relapsecure * (pmild * mildrecovery * (1 - (mildrecoverycured * (1 - increased_relapse_4))) + pmild * mildpartial * (1 - (mildpartialcured * (1 - increased_relapse_4))))) * 0.03     transition_matrix["mild_4x_1_year", "mild_chronic", ] <- leavemodel/pmild * ((pmild * mildchronic))     transition_matrix["mild_4x_1_year", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_4x_1_year", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_4))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_4))) * relapsecure * moderatecure)))     transition_matrix["moderate_4x_1_year", "moderate_5x_1_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_4))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_4))))) * 0.4     transition_matrix["moderate_4x_1_year", "moderate_5x_2_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_4))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_4))))) * 0.3     transition_matrix["moderate_4x_1_year", "moderate_5x_3_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_4))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_4))))) * 0.2     transition_matrix["moderate_4x_1_year", "moderate_5x_4_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_4))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_4))))) * 0.07     transition_matrix["moderate_4x_1_year", "moderate_5x_5_year", ] <- leavemodel/pmoderate * (relapsecure * (pmoderate * moderaterecovery * (1 - (moderaterecoverycured * (1 - increased_relapse_4))) + pmoderate * moderatepartial * (1 - (moderatepartialcured * (1 - increased_relapse_4))))) * 0.03     transition_matrix["moderate_4x_1_year", "moderate_chronic", ] <- leavemodel/pmoderate * ((pmoderate * moderatechronic))     transition_matrix["moderate_4x_1_year", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_4x_1_year", "severe_cured", ] <- leavemodel/psevere * ((psevere * severerecovery * (1 - (1 - (severerecoverycured * (1 - increased_relapse_4))) * relapsecure * severecure) + psevere * severepartial * (1 - (1 - (severepartialcured * (1 - increased_relapse_4))) * relapsecure * severecure)))     transition_matrix["severe_4x_1_year", "severe_5x_1_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_4))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_4))) * severecure)) * 0.4     transition_matrix["severe_4x_1_year", "severe_5x_2_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_4))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_4))) * severecure)) * 0.3     transition_matrix["severe_4x_1_year", "severe_5x_3_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_4))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_4))) * severecure)) * 0.2     transition_matrix["severe_4x_1_year", "severe_5x_4_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_4))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_4))) * severecure)) * 0.07     transition_matrix["severe_4x_1_year", "severe_5x_5_year", ] <- leavemodel/psevere * ((relapsecure * (psevere * severerecovery * (1 - (severerecoverycured * (1 - increased_relapse_4))) * severecure + psevere * severepartial * (1 - severepartialcured * (1 - increased_relapse_4))) * severecure)) * 0.03     transition_matrix["severe_4x_1_year", "severe_chronic", ] <- leavemodel/psevere * ((psevere * severechronic))     transition_matrix["severe_4x_1_year", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_4x_2_year", "mild_4x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_2_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_2_year", "moderate_4x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_2_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_2_year", "severe_4x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_2_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_3_year", "mild_4x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_3_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_3_year", "moderate_4x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_3_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_3_year", "severe_4x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_3_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_4_year", "mild_4x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_4_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_4_year", "moderate_4x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_4_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_4_year", "severe_4x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_4_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_5_year", "mild_4x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_4x_5_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_5_year", "moderate_4x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_4x_5_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_5_year", "severe_4x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_4x_5_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_1_year", "mild_cured", ] <- leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_5))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_5))) * relapsecure))) + `Fifth episode to chronic`     transition_matrix["mild_5x_1_year", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["mild_5x_1_year", "mild_chronic", ] <- 1 - (1 - leavemodel) - (leavemodel/pmild * ((pmild * mildrecovery * (1 - (1 - (mildrecoverycured * (1 - increased_relapse_5))) * relapsecure) + pmild * mildpartial * (1 - (1 - (mildpartialcured * (1 - increased_relapse_5))) * relapsecure))) + `Fifth episode to chronic`)     transition_matrix["moderate_5x_1_year", "moderate_cured", ] <- leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_5))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_5))) * relapsecure * moderatecure))) + `Fifth episode to chronic`     transition_matrix["moderate_5x_1_year", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_5x_1_year", "moderate_chronic", ] <- 1 - (1 - leavemodel) - (leavemodel/pmoderate * ((pmoderate * moderaterecovery * (1 - (1 - (moderaterecoverycured * (1 - increased_relapse_5))) * relapsecure * moderatecure) + pmoderate * moderatepartial * (1 - (1 - (moderatepartialcured * (1 - increased_relapse_5))) * relapsecure * moderatecure))) + `Fifth episode to chronic`)     transition_matrix["severe_5x_1_year", "severe_cured", ] <- `Fifth episode to chronic`     transition_matrix["severe_5x_1_year", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["severe_5x_1_year", "severe_chronic", ] <- 1 - (1 - leavemodel) - (`Fifth episode to chronic`)     transition_matrix["mild_5x_2_year", "mild_5x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_2_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_2_year", "moderate_5x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_2_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_2_year", "severe_5x_1_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_2_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_3_year", "mild_5x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_3_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_3_year", "moderate_5x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_3_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_3_year", "severe_5x_2_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_3_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_4_year", "mild_5x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_4_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_4_year", "moderate_5x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_4_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_4_year", "severe_5x_3_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_4_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_5_year", "mild_5x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_5x_5_year", "mild_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_5_year", "moderate_5x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["moderate_5x_5_year", "moderate_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_5_year", "severe_5x_4_year", ] <- (1 - retirement_rate) * (1 - death_rate)     transition_matrix["severe_5x_5_year", "severe_mortality", ] <- 1 - (1 - retirement_rate) * (1 - death_rate)     transition_matrix["mild_chronic", "mild_cured", ] <- (1 - 2^(-1/(mean_dur_chron * log(2)))) * (leavemodel)     transition_matrix["mild_chronic", "mild_chronic", ] <- 2^(-1/(mean_dur_chron * log(2))) * (leavemodel)     transition_matrix["mild_chronic", "mild_mortality", ] <- 1 - leavemodel     transition_matrix["moderate_chronic", "moderate_cured", ] <- (1 - 2^(-1/(mean_dur_chron * log(2)))) * (leavemodel)     transition_matrix["moderate_chronic", "moderate_chronic", ] <- 2^(-1/(mean_dur_chron * log(2))) * (leavemodel)     transition_matrix["moderate_chronic", "moderate_mortality", ] <- 1 - leavemodel     transition_matrix["severe_chronic", "severe_cured", ] <- (1 - 2^(-1/(mean_dur_chron * log(2)))) * (leavemodel)     transition_matrix["severe_chronic", "severe_chronic", ] <- 2^(-1/(mean_dur_chron * log(2))) * (leavemodel)     transition_matrix["severe_chronic", "severe_mortality", ] <- 1 - leavemodel     transition_matrix["mild_mortality", "mild_mortality", ] <- 1     transition_matrix["moderate_mortality", "moderate_mortality", ] <- 1     transition_matrix["severe_mortality", "severe_mortality", ] <- 1     return(transition_matrix) })(death_rate = 0.00198371022638523, retirement_rate = 0.02128, excess_mortality = 1.65, increased_relapse_1 = 0.5, increased_relapse_2 = 0.7, increased_relapse_3 = 0.899999976158142, increased_relapse_4 = 0.949999988079071, increased_relapse_5 = 0.990000009536743, mean_dur_chron = 3.95964163041925, leavemodel = 0.975516530159933, incidence_no_history = 0.0128446472713444, pmild = 0.3, pmoderate = 0.47, psevere = 0.23, mildrecovery = 0.6, mildpartial = 0.37, mildchronic = 0.03, moderaterecovery = 0.475,      moderatepartial = 0.495, moderatechronic = 0.03, severerecovery = 0.51, severepartial = 0.46, severechronic = 0.03, mildrecoverycured = 0.458333, mildrecoveryrelapse = 0.5416666, mildpartialcured = 0.2, mildpartialrelapse = 0.8, moderaterecoverycured = 0.49, moderaterecoveryrelapse = 0.51, moderatepartialcured = 0.25, moderatepartialrelapse = 0.75, severerecoverycured = 0.49, severerecoveryrelapse = 0.51, severepartialcured = 0.25, severepartialrelapse = 0.75)`: object 'relapsecure' not found