Heterogeneity & Demographic Analysis

2022-03-16

Introduction

Heterogeneity analysis is a way to explore how the results of a model can vary depending on the characteristics of individuals in a population, and demographic analysis estimates the average values of a model over an entire population.

In practice these two analyses naturally complement each other: heterogeneity analysis runs the model on multiple sets of parameters (reflecting differents characteristics found in the target population), and demographic analysis combines the results.

For this example we will use the result from the assessment of a new total hip replacement previously described in vignette("d-non-homogeneous", "heemod").

Population characteristics

The characteristics of the population are input from a table, with one column per parameter and one row per individual. Those may be for example the characteristics of the indiviuals included in the original trial data.

For this example we will use the characteristics of 100 individuals, with varying sex and age, specified in the data frame tab_indiv:

tab_indiv
## # A tibble: 100 x 2
##      age   sex
##    <dbl> <int>
##  1    32     1
##  2    56     1
##  3    53     1
##  4    65     1
##  5    38     0
##  6    66     1
##  7    59     0
##  8    48     1
##  9    60     0
## 10    62     0
## # ... with 90 more rows
library(ggplot2)
ggplot(tab_indiv, aes(x = age)) +
  geom_histogram(binwidth = 2)

Running the analysis

res_mod, the result we obtained from run_model() in the Time-varying Markov models vignette, can be passed to update() to update the model with the new data and perform the heterogeneity analysis.

res_h <- update(res_mod, newdata = tab_indiv)
## No weights specified in update, using equal weights.
## Updating strategy 'standard'...
## Updating strategy 'np1'...

Interpreting results

The summary() method reports summary statistics for cost, effect and ICER, as well as the result from the combined model.

summary(res_h)
## An analysis re-run on 100 parameter sets.
## 
## * Unweighted analysis.
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          530.94590166  605.0062810 621.9893893 685.2381026
## standard - Effect          9.32287610   25.6577436  27.7806580  27.0726753
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               615.48340627  635.5509751 640.1676766 658.3659693
## np1 - Effect               9.38064927   25.8299343  27.9754765  27.3341846
## np1 - Cost Diff.        -167.83433856 -110.7286273  18.1782873 -26.8721332
## np1 - Effect Diff.         0.05777317    0.1948185   0.2214442   0.2615092
## np1 - Icer              -355.65308588 -316.4394659  82.0897023   4.2323184
##                             3rd Qu.         Max.
## standard - Cost         802.3426777  882.1752204
## standard - Effect        30.2219909   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504  714.3408818
## np1 - Effect             30.4434351   31.8353665
## np1 - Cost Diff.         30.5446941   84.5375046
## np1 - Effect Diff.        0.3499204    0.4719046
## np1 - Icer              156.7853582 1275.2350079
## 
## * Combined result:
## 
## 2 strategies run for 60 cycles.
## 
## Initial state counts:
## 
## PrimaryTHR = 1000L
## SuccessP = 0L
## RevisionTHR = 0L
## SuccessR = 0L
## Death = 0L
## 
## Counting method: 'beginning'.
## 
## Values:
## 
##           utility     cost
## standard 27072.68 685238.1
## np1      27334.18 658366.0
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -26.87213    0.2615092 -102.7579 standard

The variation of cost or effect can then be plotted.

plot(res_h, result = "effect", binwidth = 5)

plot(res_h, result = "cost", binwidth = 50)

plot(res_h, result = "icer", type = "difference",
     binwidth = 500)

plot(res_h, result = "effect", type = "difference",
     binwidth = .1)

plot(res_h, result = "cost", type = "difference",
     binwidth = 30)

The results from the combined model can be plotted similarly to the results from run_model().

plot(res_h, type = "counts")

Weighted results

Weights can be used in the analysis by including an optional column .weights in the new data to specify the respective weights of each strata in the target population.

tab_indiv_w
## # A tibble: 100 x 3
##      age   sex .weights
##    <dbl> <int>    <dbl>
##  1    65     1    0.543
##  2    56     0    0.257
##  3    63     1    0.784
##  4    71     0    0.240
##  5    53     1    0.872
##  6    68     0    0.558
##  7    72     0    0.239
##  8    42     1    0.674
##  9    68     1    0.908
## 10    64     0    0.391
## # ... with 90 more rows
res_w <- update(res_mod, newdata = tab_indiv_w)
## Updating strategy 'standard'...
## Updating strategy 'np1'...
res_w
## An analysis re-run on 100 parameter sets.
## 
## * Weigths distribution:
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.02336 0.35455 0.58339 0.56491 0.78636 0.99446 
## 
## Total weight: 56.4915
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          489.70561885  605.0062810 629.9316751 701.6031159
## standard - Effect          6.14259603   25.5696426  27.3769142  26.1663890
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               604.44079805  635.5509751 643.0316939 663.0711056
## np1 - Effect               6.16727815   25.8299343  27.7656911  26.4375563
## np1 - Cost Diff.        -169.74573893 -129.4829089  13.1000189 -38.5320103
## np1 - Effect Diff.         0.02468212    0.1948185   0.2214442   0.2711673
## np1 - Icer              -356.48325605 -333.0519971  82.0897023  -3.7874031
##                             3rd Qu.         Max.
## standard - Cost         828.5434528  884.8498736
## standard - Effect        29.0459530   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439  715.1041347
## np1 - Effect             29.2544960   31.8353665
## np1 - Cost Diff.         30.5446941  114.7351792
## np1 - Effect Diff.        0.3887769    0.4761675
## np1 - Icer              156.7853582 4648.5141231
## 
## * Combined result:
## 
## 2 strategies run for 60 cycles.
## 
## Initial state counts:
## 
## PrimaryTHR = 1000L
## SuccessP = 0L
## RevisionTHR = 0L
## SuccessR = 0L
## Death = 0L
## 
## Counting method: 'beginning'.
## 
## Values:
## 
##           utility     cost
## standard 26166.39 701603.1
## np1      26437.56 663071.1
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -38.53201    0.2711673 -142.0968 standard

Parallel computing

Updating can be significantly sped up by using parallel computing. This can be done in the following way:

Results may vary depending on the machine, but we found speed gains to be quite limited beyond 4 cores.