M1_gmod_intro_markov_tutorial.RmdThis vignette replicates our introductory tutorial for Markov models in Medical Decision Making:
Alarid-Escudero, F., Krijkamp, E., Enns, E. A., Yang, A., Hunink, M. M., Pechlivanoglou, P., & Jalal, H. (2023). An introductory tutorial on cohort state-transition models in r using a cost-effectiveness analysis example. Medical Decision Making, 43(1), 3-20.
If you haven’t already, install gmod using devtools. Also, make sure to enable use_vignettes so that vignettes render correctly.
#library(devtools)
#install_github("hjalal/gmod", use_vignettes = TRUE, force = TRUE)
rm(list = ls())
library(gmod)
#> Please note that active development of gmod is now moved to twig. Please install twig https://hjalal.github.io/twig/ and review the vignettes for the latest features.The Markov model involves a cost-effectiveness example with 4 decisions and 4 states. For more details on the model, please refer to the reference above. First we define the gmod object and the layers.
mygmod <- gmod() +
decisions("StandardOfCare", "StrategyA", "StrategyB", "StrategyAB") +
states(names = c("H", "S1", "S2", "D"), init_probs = c(1,0,0,0)) +
event(name = "get_event",
scenarios = c("recover", "getsick", "progress", "die", "stay"),
probs = c(pRecover(state), pGetSick(state), pProgress(state, decision), pDie(state), Inf),
outcomes = c("H", "S1", "S2", "D", "curr_state")) +
payoffs(cost = cost(state, decision),
utility = utility(state, decision),
discount_rates = c(0.03, 0.03))The gmod() function defines the model type as a Markov
model and number of cycles as 75. The decision() function
defines the treatment strategies. The initial_probs()
defines the initial probabilities. Here we only define the “Moderate”
states as the starting state with probability equals 1. The other states
will be set to 0.
Since the tutorial assumes that all the events happen simultaneously
(i.e., no sequence), we add a single event_mapping() layer
we model the individual final_outcomes separately. We can interpret the
event_mapping as the following: The event get_event can
have 5 values: recover, getsick, progress, die, or stay in the same
state. These values will outcome in the following states: H, S1, S2, D
and staying in the current state, respectively. The prob argument
defines the probability of these final_outcomes. For example, pRecover()
defins the probability of recovering and it is a function of state
because this probability is only applied if the state is “S1”, and is 0
otherwise. Note here we use Inf here is as a placeholder to
reduce the amount of typing required. Then, we define the payoffs of
cost and utility and define each as a function of the state and the
decision taken.
The "curr_state" is a build-in function that instructs
gmod to compute the probability of a state returning to itself.
Before we can evaluate the model, first we need to pass the parameter
values. Here we use the global environment to define those. Later, we
show how to pass these as a parameter list param which will
be helpful for analyses such as probabilitistic sensitivity
analyses.
params <- list(
r_HD = 0.002,
r_HS1 = 0.15,
r_S1H = 0.5,
r_S1S2 = 0.105,
hr_S1 = 3,
hr_S2 = 10,
hr_S1S2_trtB = 0.6,
c_H = 2000,
c_S1 = 4000,
c_S2 = 15000,
c_D = 0,
c_trtA = 12000,
c_trtB = 13000,
u_H = 1,
u_S1 = 0.75,
u_S2 = 0.5,
u_D = 0,
u_trtA = 0.95
)The model has six user-defined functions: four for computing
probabilities pRecover(), pGetSick(),
pProgress() and pDie(), and 2 for payoffs
cost() and utility().
probability of recover is only dependent on state being S1 otherwise is 0. Following the tutorial, we convert the rate of recover r_S1H to a probability by using the function rate2prob().
pRecover <- function(state){
rRecover <- if (state=="S1") r_S1H else 0
rate2prob(rRecover)
}This is a standard function and can be evaluated like any other function. For example, we can type
#pRecover("S1")
#pRecover("S2")probability of getting sick is also a function of a single state “H” otherwise is 0.
pGetSick <- function(state){
rGetSick <- if (state=="H") r_HS1 else 0
rate2prob(rGetSick)
}probability of progress is slightly more complex as it is a function of both the state and the decision.
pProgress <- function(state, decision){
hr_S1S2 <- if (decision %in% c("StrategyB", "StrategyAB")) hr_S1S2_trtB else 1
rProgress <- (state=="S1") * r_S1S2 * hr_S1S2
rate2prob(rProgress)
}hr_S1S2 is a function of the decision if it contains “B” then it is hr_S1S2_trtB otherwise is 1. then the rate of progression is only conditional on state being S1 which gets multiplied by the r_S1S2 and the hr_S1S2.
Using expressions such as (state==“S1”) are very helpful as they can reduce the typing required and are easy to read once one gets using to them. This expression is shorthand of a full if…then statement:
state <- "S1"
# these two statements are equivalent and both return TRUE:
(state=="S1")
#> [1] TRUE
if (state=="S1") TRUE else FALSE
#> [1] TRUEProbability of death is a function of the state. For states S1 and S2 the rate of mortality is relative to the healthy rate multiplied by a hazard ratio for each state.
pDie <- function(state){
rDie <- switch(state,
"H" = r_HD,
"S1" = r_HD*hr_S1,
"S2" = r_HD*hr_S2,
"D" = Inf) #translates to probability of 1
rate2prob(rDie)
}The payoffs are a cost and utility function. Both are dependent on both the state and the decision. For example only those in S1 and S2 receive treatment.
cost <- function(state, decision){
# cost of decision is only applied if the state is either S1 or S2
if (state %in% c("S1","S2")){
c_decision <- switch(decision,
"StandardOfCare" = 0,
"StrategyA" = c_trtA ,
"StrategyB" = c_trtB,
"StrategyAB" = c_trtA + c_trtB)}
else {
c_decision <- 0
}
# cost of the state is a function of the state
c_state <- switch(state,
"H" = c_H,
"S1" = c_S1,
"S2" = c_S2,
"D" = c_D)
# combine both
return(c_decision + c_state)
}Similarly the utility function is a function of the state and decision. For H, S2 and D, the utility is independent of the decision. But, Strategies involving “A” improve the utility of S1 from u_S1 to u_trtA. One way to code this is:
utility <- function(state, decision){
u_state <- switch(state,
"H" = u_H,
"S1" = if (decision %in% c("StrategyA", "StrategyAB")) u_trtA else u_S1,
"S2" = u_S2,
"D" = u_D)
}Then, we build the gmod Markov model by using the
gmod_gen_model_function() function. The output is the
structure of the model including the formulae.
To evaluate the model, we run gmod_evaluate() which
returns the numerical outcomes. The model structure can also be returned
directly from the
model_struc <- gmod_gen_model_function(mygmod)
#> Warning in gmod_gen_model_function.gmod_markov(mygmod): Model function my_markov_model is generated. It can be run by calling it directly, for example this function returns the summary results:
#> my_markov_model(model_struc,params,return_transition_prob=FALSE,return_state_payoffs=FALSE,return_trace=FALSE,return_cycle_payoffs=FALSE,return_payoff_summary=TRUE)
#model_res
n_cycles <- 75
model_res <- my_markov_model(model_struc, params, return_trace = T)The warning just indicates that no parameters were passed, so gmod
uses the values in the global environment. For analyses, such as
probabilistic sensitivity analysis (PSA), we can pass the parameters as
a list param.
We can load individual outcomes here that we are interested in. For example, if we are interested in the Markov Trace of the Standard of Care treatment, we can type:
model_res$Trace
#> , , StandardOfCare
#>
#> H S1 S2 D
#> 1 1.0000000 0.00000000 0.00000000 0.000000000
#> 2 0.8587100 0.13929202 0.00000000 0.001998001
#> 3 0.7921900 0.18937908 0.01388400 0.004546955
#> 4 0.7547763 0.20520064 0.03248553 0.007537546
#> 5 0.7288741 0.20791381 0.05229574 0.010916364
#> 6 0.7076992 0.20566479 0.07198413 0.014651928
#> 7 0.6886311 0.20158882 0.09105848 0.018721587
#> 8 0.6706534 0.19689125 0.10934886 0.023106464
#> 9 0.6533675 0.19203421 0.12680884 0.027789493
#> 10 0.6366127 0.18719365 0.14343896 0.032754661
#> 11 0.6203207 0.18243535 0.15925729 0.037986695
#> 12 0.6044583 0.17778269 0.17428812 0.043470937
#> 13 0.5890064 0.17324279 0.18855756 0.049193284
#> 14 0.5739514 0.16881655 0.20209192 0.055140154
#> 15 0.5592819 0.16450252 0.21491711 0.061298464
#> 16 0.5449877 0.16029841 0.22705833 0.067655614
#> 17 0.5310588 0.15620160 0.23854009 0.074199467
#> 18 0.5174861 0.15220945 0.24938615 0.080918337
#> 19 0.5042602 0.14831931 0.25961953 0.087800974
#> 20 0.4913724 0.14452858 0.26926251 0.094836549
#> 21 0.4788139 0.14083473 0.27833671 0.102014642
#> 22 0.4665764 0.13723530 0.28686305 0.109325227
#> 23 0.4546517 0.13372785 0.29486177 0.116758663
#> 24 0.4430318 0.13031005 0.30235250 0.124305677
#> 25 0.4317088 0.12697960 0.30935424 0.131957355
#> 26 0.4206752 0.12373426 0.31588537 0.139705131
#> 27 0.4099237 0.12057188 0.32196369 0.147540772
#> 28 0.3994469 0.11749031 0.32760644 0.155456374
#> 29 0.3892379 0.11448751 0.33283030 0.163444343
#> 30 0.3792897 0.11156145 0.33765142 0.171497390
#> 31 0.3695959 0.10871017 0.34208541 0.179608522
#> 32 0.3601498 0.10593176 0.34614740 0.187771028
#> 33 0.3509451 0.10322437 0.34985202 0.195978474
#> 34 0.3419757 0.10058617 0.35321343 0.204224689
#> 35 0.3332355 0.09801540 0.35624531 0.212503761
#> 36 0.3247187 0.09551033 0.35896091 0.220810028
#> 37 0.3164196 0.09306929 0.36137305 0.229138065
#> 38 0.3083326 0.09069063 0.36349411 0.237482681
#> 39 0.3004522 0.08837277 0.36533607 0.245838910
#> 40 0.2927733 0.08611415 0.36691053 0.254202002
#> 41 0.2852906 0.08391325 0.36822869 0.262567417
#> 42 0.2779992 0.08176861 0.36930136 0.270930817
#> 43 0.2708941 0.07967877 0.37013903 0.279288059
#> 44 0.2639707 0.07764235 0.37075181 0.287635191
#> 45 0.2572241 0.07565797 0.37114947 0.295968442
#> 46 0.2506500 0.07372432 0.37134146 0.304284216
#> 47 0.2442439 0.07184008 0.37133691 0.312579091
#> 48 0.2380016 0.07000399 0.37114464 0.320849804
#> 49 0.2319187 0.06821484 0.37077317 0.329093254
#> 50 0.2259914 0.06647141 0.37023072 0.337306492
#> 51 0.2202155 0.06477254 0.36952523 0.345486717
#> 52 0.2145873 0.06311709 0.36866437 0.353631269
#> 53 0.2091029 0.06150395 0.36765555 0.361737627
#> 54 0.2037586 0.05993204 0.36650592 0.369803402
#> 55 0.1985510 0.05840030 0.36522237 0.377826331
#> 56 0.1934764 0.05690771 0.36381156 0.385804276
#> 57 0.1885316 0.05545327 0.36227991 0.393735218
#> 58 0.1837131 0.05403600 0.36063362 0.401617251
#> 59 0.1790178 0.05265496 0.35887866 0.409448579
#> 60 0.1744425 0.05130921 0.35702080 0.417227514
#> 61 0.1699841 0.04999785 0.35506558 0.424952470
#> 62 0.1656397 0.04872001 0.35301837 0.432621957
#> 63 0.1614063 0.04747483 0.35088433 0.440234582
#> 64 0.1572811 0.04626147 0.34866843 0.447789043
#> 65 0.1532613 0.04507913 0.34637547 0.455284126
#> 66 0.1493442 0.04392700 0.34401006 0.462718701
#> 67 0.1455273 0.04280432 0.34157665 0.470091720
#> 68 0.1418079 0.04171033 0.33907951 0.477402211
#> 69 0.1381836 0.04064430 0.33652279 0.484649280
#> 70 0.1346519 0.03960552 0.33391043 0.491832105
#> 71 0.1312105 0.03859328 0.33124626 0.498949931
#> 72 0.1278571 0.03760692 0.32853395 0.506002071
#> 73 0.1245893 0.03664576 0.32577703 0.512987904
#> 74 0.1214051 0.03570918 0.32297889 0.519906867
#> 75 0.1183022 0.03479652 0.32014281 0.526758459
#>
#> , , StrategyA
#>
#> H S1 S2 D
#> 1 1.0000000 0.00000000 0.00000000 0.000000000
#> 2 0.8587100 0.13929202 0.00000000 0.001998001
#> 3 0.7921900 0.18937908 0.01388400 0.004546955
#> 4 0.7547763 0.20520064 0.03248553 0.007537546
#> 5 0.7288741 0.20791381 0.05229574 0.010916364
#> 6 0.7076992 0.20566479 0.07198413 0.014651928
#> 7 0.6886311 0.20158882 0.09105848 0.018721587
#> 8 0.6706534 0.19689125 0.10934886 0.023106464
#> 9 0.6533675 0.19203421 0.12680884 0.027789493
#> 10 0.6366127 0.18719365 0.14343896 0.032754661
#> 11 0.6203207 0.18243535 0.15925729 0.037986695
#> 12 0.6044583 0.17778269 0.17428812 0.043470937
#> 13 0.5890064 0.17324279 0.18855756 0.049193284
#> 14 0.5739514 0.16881655 0.20209192 0.055140154
#> 15 0.5592819 0.16450252 0.21491711 0.061298464
#> 16 0.5449877 0.16029841 0.22705833 0.067655614
#> 17 0.5310588 0.15620160 0.23854009 0.074199467
#> 18 0.5174861 0.15220945 0.24938615 0.080918337
#> 19 0.5042602 0.14831931 0.25961953 0.087800974
#> 20 0.4913724 0.14452858 0.26926251 0.094836549
#> 21 0.4788139 0.14083473 0.27833671 0.102014642
#> 22 0.4665764 0.13723530 0.28686305 0.109325227
#> 23 0.4546517 0.13372785 0.29486177 0.116758663
#> 24 0.4430318 0.13031005 0.30235250 0.124305677
#> 25 0.4317088 0.12697960 0.30935424 0.131957355
#> 26 0.4206752 0.12373426 0.31588537 0.139705131
#> 27 0.4099237 0.12057188 0.32196369 0.147540772
#> 28 0.3994469 0.11749031 0.32760644 0.155456374
#> 29 0.3892379 0.11448751 0.33283030 0.163444343
#> 30 0.3792897 0.11156145 0.33765142 0.171497390
#> 31 0.3695959 0.10871017 0.34208541 0.179608522
#> 32 0.3601498 0.10593176 0.34614740 0.187771028
#> 33 0.3509451 0.10322437 0.34985202 0.195978474
#> 34 0.3419757 0.10058617 0.35321343 0.204224689
#> 35 0.3332355 0.09801540 0.35624531 0.212503761
#> 36 0.3247187 0.09551033 0.35896091 0.220810028
#> 37 0.3164196 0.09306929 0.36137305 0.229138065
#> 38 0.3083326 0.09069063 0.36349411 0.237482681
#> 39 0.3004522 0.08837277 0.36533607 0.245838910
#> 40 0.2927733 0.08611415 0.36691053 0.254202002
#> 41 0.2852906 0.08391325 0.36822869 0.262567417
#> 42 0.2779992 0.08176861 0.36930136 0.270930817
#> 43 0.2708941 0.07967877 0.37013903 0.279288059
#> 44 0.2639707 0.07764235 0.37075181 0.287635191
#> 45 0.2572241 0.07565797 0.37114947 0.295968442
#> 46 0.2506500 0.07372432 0.37134146 0.304284216
#> 47 0.2442439 0.07184008 0.37133691 0.312579091
#> 48 0.2380016 0.07000399 0.37114464 0.320849804
#> 49 0.2319187 0.06821484 0.37077317 0.329093254
#> 50 0.2259914 0.06647141 0.37023072 0.337306492
#> 51 0.2202155 0.06477254 0.36952523 0.345486717
#> 52 0.2145873 0.06311709 0.36866437 0.353631269
#> 53 0.2091029 0.06150395 0.36765555 0.361737627
#> 54 0.2037586 0.05993204 0.36650592 0.369803402
#> 55 0.1985510 0.05840030 0.36522237 0.377826331
#> 56 0.1934764 0.05690771 0.36381156 0.385804276
#> 57 0.1885316 0.05545327 0.36227991 0.393735218
#> 58 0.1837131 0.05403600 0.36063362 0.401617251
#> 59 0.1790178 0.05265496 0.35887866 0.409448579
#> 60 0.1744425 0.05130921 0.35702080 0.417227514
#> 61 0.1699841 0.04999785 0.35506558 0.424952470
#> 62 0.1656397 0.04872001 0.35301837 0.432621957
#> 63 0.1614063 0.04747483 0.35088433 0.440234582
#> 64 0.1572811 0.04626147 0.34866843 0.447789043
#> 65 0.1532613 0.04507913 0.34637547 0.455284126
#> 66 0.1493442 0.04392700 0.34401006 0.462718701
#> 67 0.1455273 0.04280432 0.34157665 0.470091720
#> 68 0.1418079 0.04171033 0.33907951 0.477402211
#> 69 0.1381836 0.04064430 0.33652279 0.484649280
#> 70 0.1346519 0.03960552 0.33391043 0.491832105
#> 71 0.1312105 0.03859328 0.33124626 0.498949931
#> 72 0.1278571 0.03760692 0.32853395 0.506002071
#> 73 0.1245893 0.03664576 0.32577703 0.512987904
#> 74 0.1214051 0.03570918 0.32297889 0.519906867
#> 75 0.1183022 0.03479652 0.32014281 0.526758459
#>
#> , , StrategyB
#>
#> H S1 S2 D
#> 1 1.0000000 0.00000000 0.000000000 0.000000000
#> 2 0.8587100 0.13929202 0.000000000 0.001998001
#> 3 0.7921900 0.19475840 0.008504687 0.004546955
#> 4 0.7568929 0.21541636 0.020227554 0.007463207
#> 5 0.7347112 0.22164456 0.032979596 0.010664641
#> 6 0.7181142 0.22191490 0.045859404 0.014111521
#> 7 0.7039685 0.21974891 0.058500680 0.017781894
#> 8 0.6909692 0.21661000 0.070759394 0.021661361
#> 9 0.6785716 0.21310589 0.082583718 0.025738817
#> 10 0.6665468 0.20948855 0.093959956 0.030004678
#> 11 0.6547977 0.20586207 0.104890068 0.034450139
#> 12 0.6432817 0.20226906 0.115382328 0.039066863
#> 13 0.6319791 0.19872658 0.125447451 0.043846844
#> 14 0.6208796 0.19524107 0.135096980 0.048782355
#> 15 0.6099769 0.19181459 0.144342622 0.053865912
#> 16 0.5992664 0.18844737 0.153195979 0.059090264
#> 17 0.5887443 0.18513889 0.161668437 0.064448381
#> 18 0.5784071 0.18188835 0.169771125 0.069933450
#> 19 0.5682514 0.17869482 0.177514903 0.075538864
#> 20 0.5582741 0.17555733 0.184910357 0.081258221
#> 21 0.5484720 0.17247492 0.191967808 0.087085314
#> 22 0.5388419 0.16944663 0.198697310 0.093014130
#> 23 0.5293810 0.16647150 0.205108662 0.099038843
#> 24 0.5200862 0.16354861 0.211211410 0.105153809
#> 25 0.5109545 0.16067704 0.217014853 0.111353562
#> 26 0.5019833 0.15785588 0.222528053 0.117632808
#> 27 0.4931695 0.15508427 0.227759835 0.123986421
#> 28 0.4845105 0.15236131 0.232718794 0.130409441
#> 29 0.4760035 0.14968616 0.237413306 0.136897065
#> 30 0.4676458 0.14705799 0.241851524 0.143444647
#> 31 0.4594350 0.14447596 0.246041393 0.150047691
#> 32 0.4513682 0.14193926 0.249990648 0.156701849
#> 33 0.4434432 0.13944711 0.253706819 0.163402916
#> 34 0.4356572 0.13699871 0.257197244 0.170146825
#> 35 0.4280080 0.13459330 0.260469062 0.176929647
#> 36 0.4204931 0.13223012 0.263529228 0.183747582
#> 37 0.4131101 0.12990844 0.266384512 0.190596962
#> 38 0.4058567 0.12762751 0.269041503 0.197474240
#> 39 0.3987307 0.12538664 0.271506617 0.204375993
#> 40 0.3917299 0.12318512 0.273786098 0.211298916
#> 41 0.3848519 0.12102224 0.275886026 0.218239819
#> 42 0.3780947 0.11889735 0.277812314 0.225195622
#> 43 0.3714562 0.11680976 0.279570721 0.232163357
#> 44 0.3649342 0.11475882 0.281166847 0.239140158
#> 45 0.3585267 0.11274390 0.282606146 0.246123265
#> 46 0.3522317 0.11076435 0.283893920 0.253110016
#> 47 0.3460473 0.10881956 0.285035330 0.260097848
#> 48 0.3399714 0.10690892 0.286035397 0.267084291
#> 49 0.3340022 0.10503182 0.286899003 0.274066968
#> 50 0.3281378 0.10318768 0.287630900 0.281043590
#> 51 0.3223764 0.10137592 0.288235708 0.288011956
#> 52 0.3167162 0.09959597 0.288717920 0.294969948
#> 53 0.3111553 0.09784727 0.289081907 0.301915532
#> 54 0.3056921 0.09612928 0.289331916 0.308846752
#> 55 0.3003247 0.09444145 0.289472080 0.315761729
#> 56 0.2950517 0.09278326 0.289506416 0.322658662
#> 57 0.2898712 0.09115418 0.289438828 0.329535819
#> 58 0.2847816 0.08955370 0.289273113 0.336391543
#> 59 0.2797815 0.08798133 0.289012959 0.343224242
#> 60 0.2748691 0.08643656 0.288661953 0.350032393
#> 61 0.2700430 0.08491891 0.288223580 0.356814538
#> 62 0.2653016 0.08342791 0.287701224 0.363569282
#> 63 0.2606434 0.08196309 0.287098177 0.370295289
#> 64 0.2560671 0.08052399 0.286417634 0.376991286
#> 65 0.2515711 0.07911016 0.285662700 0.383656055
#> 66 0.2471540 0.07772115 0.284836391 0.390288435
#> 67 0.2428145 0.07635653 0.283941636 0.396887318
#> 68 0.2385512 0.07501587 0.282981280 0.403451650
#> 69 0.2343627 0.07369875 0.281958084 0.409980428
#> 70 0.2302478 0.07240475 0.280874729 0.416472698
#> 71 0.2262052 0.07113348 0.279733819 0.422927554
#> 72 0.2222335 0.06988452 0.278537882 0.429344136
#> 73 0.2183315 0.06865750 0.277289368 0.435721630
#> 74 0.2144981 0.06745201 0.275990659 0.442059265
#> 75 0.2107319 0.06626770 0.274644064 0.448356314
#>
#> , , StrategyAB
#>
#> H S1 S2 D
#> 1 1.0000000 0.00000000 0.000000000 0.000000000
#> 2 0.8587100 0.13929202 0.000000000 0.001998001
#> 3 0.7921900 0.19475840 0.008504687 0.004546955
#> 4 0.7568929 0.21541636 0.020227554 0.007463207
#> 5 0.7347112 0.22164456 0.032979596 0.010664641
#> 6 0.7181142 0.22191490 0.045859404 0.014111521
#> 7 0.7039685 0.21974891 0.058500680 0.017781894
#> 8 0.6909692 0.21661000 0.070759394 0.021661361
#> 9 0.6785716 0.21310589 0.082583718 0.025738817
#> 10 0.6665468 0.20948855 0.093959956 0.030004678
#> 11 0.6547977 0.20586207 0.104890068 0.034450139
#> 12 0.6432817 0.20226906 0.115382328 0.039066863
#> 13 0.6319791 0.19872658 0.125447451 0.043846844
#> 14 0.6208796 0.19524107 0.135096980 0.048782355
#> 15 0.6099769 0.19181459 0.144342622 0.053865912
#> 16 0.5992664 0.18844737 0.153195979 0.059090264
#> 17 0.5887443 0.18513889 0.161668437 0.064448381
#> 18 0.5784071 0.18188835 0.169771125 0.069933450
#> 19 0.5682514 0.17869482 0.177514903 0.075538864
#> 20 0.5582741 0.17555733 0.184910357 0.081258221
#> 21 0.5484720 0.17247492 0.191967808 0.087085314
#> 22 0.5388419 0.16944663 0.198697310 0.093014130
#> 23 0.5293810 0.16647150 0.205108662 0.099038843
#> 24 0.5200862 0.16354861 0.211211410 0.105153809
#> 25 0.5109545 0.16067704 0.217014853 0.111353562
#> 26 0.5019833 0.15785588 0.222528053 0.117632808
#> 27 0.4931695 0.15508427 0.227759835 0.123986421
#> 28 0.4845105 0.15236131 0.232718794 0.130409441
#> 29 0.4760035 0.14968616 0.237413306 0.136897065
#> 30 0.4676458 0.14705799 0.241851524 0.143444647
#> 31 0.4594350 0.14447596 0.246041393 0.150047691
#> 32 0.4513682 0.14193926 0.249990648 0.156701849
#> 33 0.4434432 0.13944711 0.253706819 0.163402916
#> 34 0.4356572 0.13699871 0.257197244 0.170146825
#> 35 0.4280080 0.13459330 0.260469062 0.176929647
#> 36 0.4204931 0.13223012 0.263529228 0.183747582
#> 37 0.4131101 0.12990844 0.266384512 0.190596962
#> 38 0.4058567 0.12762751 0.269041503 0.197474240
#> 39 0.3987307 0.12538664 0.271506617 0.204375993
#> 40 0.3917299 0.12318512 0.273786098 0.211298916
#> 41 0.3848519 0.12102224 0.275886026 0.218239819
#> 42 0.3780947 0.11889735 0.277812314 0.225195622
#> 43 0.3714562 0.11680976 0.279570721 0.232163357
#> 44 0.3649342 0.11475882 0.281166847 0.239140158
#> 45 0.3585267 0.11274390 0.282606146 0.246123265
#> 46 0.3522317 0.11076435 0.283893920 0.253110016
#> 47 0.3460473 0.10881956 0.285035330 0.260097848
#> 48 0.3399714 0.10690892 0.286035397 0.267084291
#> 49 0.3340022 0.10503182 0.286899003 0.274066968
#> 50 0.3281378 0.10318768 0.287630900 0.281043590
#> 51 0.3223764 0.10137592 0.288235708 0.288011956
#> 52 0.3167162 0.09959597 0.288717920 0.294969948
#> 53 0.3111553 0.09784727 0.289081907 0.301915532
#> 54 0.3056921 0.09612928 0.289331916 0.308846752
#> 55 0.3003247 0.09444145 0.289472080 0.315761729
#> 56 0.2950517 0.09278326 0.289506416 0.322658662
#> 57 0.2898712 0.09115418 0.289438828 0.329535819
#> 58 0.2847816 0.08955370 0.289273113 0.336391543
#> 59 0.2797815 0.08798133 0.289012959 0.343224242
#> 60 0.2748691 0.08643656 0.288661953 0.350032393
#> 61 0.2700430 0.08491891 0.288223580 0.356814538
#> 62 0.2653016 0.08342791 0.287701224 0.363569282
#> 63 0.2606434 0.08196309 0.287098177 0.370295289
#> 64 0.2560671 0.08052399 0.286417634 0.376991286
#> 65 0.2515711 0.07911016 0.285662700 0.383656055
#> 66 0.2471540 0.07772115 0.284836391 0.390288435
#> 67 0.2428145 0.07635653 0.283941636 0.396887318
#> 68 0.2385512 0.07501587 0.282981280 0.403451650
#> 69 0.2343627 0.07369875 0.281958084 0.409980428
#> 70 0.2302478 0.07240475 0.280874729 0.416472698
#> 71 0.2262052 0.07113348 0.279733819 0.422927554
#> 72 0.2222335 0.06988452 0.278537882 0.429344136
#> 73 0.2183315 0.06865750 0.277289368 0.435721630
#> 74 0.2144981 0.06745201 0.275990659 0.442059265
#> 75 0.2107319 0.06626770 0.274644064 0.448356314
rowSums(model_res$Trace)
#> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
#> 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
#> 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4Similarly, we can load the summary outcomes of the costs and utility of the strategies, such that:
model_res$summary
#> cost utility
#> StandardOfCare 153147.4 21.51271
#> StrategyA 286335.9 22.29992
#> StrategyB 260580.0 22.98355
#> StrategyAB 380280.9 23.93511