Heterogeneity & Demographic Analysis

2019-10-22

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    58     1
##  2    42     1
##  3    56     0
##  4    56     0
##  5    72     1
##  6    65     0
##  7    57     1
##  8    50     0
##  9    71     1
## 10    59     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          485.85297365  613.836464 666.7030559 703.780614
## standard - Effect          9.32287610   25.569643  27.3769142  26.349090
## standard - Cost Diff.               -           -           -          -
## standard - Effect Diff.             -           -           -          -
## standard - Icer                     -           -           -          -
## np1 - Cost               603.34263272  637.950820 652.9763466 663.683957
## np1 - Effect               9.38064927   25.829934  27.7656911  26.623295
## np1 - Cost Diff.        -164.88137326 -129.482909 -13.7267093 -40.096657
## np1 - Effect Diff.         0.04405769    0.208543   0.2214442   0.274205
## np1 - Icer              -354.32431375 -333.051997 -67.3676226  -7.494663
##                             3rd Qu.         Max.
## standard - Cost         828.5434528  878.0433890
## standard - Effect        29.0749005   31.7692206
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439  713.1620157
## np1 - Effect             29.5008365   32.0078346
## np1 - Cost Diff.         24.1143568  117.4896591
## np1 - Effect Diff.        0.3887769    0.4653403
## np1 - Icer              115.6325465 2666.7229585
## 
## * Combined result:
## 
## 2 strategies run for 60 cycles.
## 
## Initial state counts:
## 
## PrimaryTHR = 1000L
## SuccessP = 0L
## RevisionTHR = 0L
## SuccessR = 0L
## Death = 0L
## 
## Counting method: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 26349.09 703780.6
## np1      26623.30 663684.0
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -40.09666     0.274205 -146.2288 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    62     0   0.525 
##  2    59     0   0.207 
##  3    52     1   0.519 
##  4    60     1   0.0467
##  5    70     1   0.376 
##  6    71     1   0.0711
##  7    44     1   0.589 
##  8    68     1   0.708 
##  9    56     0   0.442 
## 10    77     0   0.453 
## # … 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.0000465 0.3374694 0.5016694 0.5104394 0.7291203 0.9850785 
## 
## Total weight: 51.04394
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          489.70561885  605.0062810 629.0973205 694.9448318
## standard - Effect          6.14259603   25.5696426  27.7806580  26.6632830
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               604.44079805  635.5509751 642.1011918 661.1477165
## np1 - Effect               6.16727815   25.8299343  27.9754765  26.9314023
## np1 - Cost Diff.        -160.47985885 -110.7286273  13.0601255 -33.7971153
## np1 - Effect Diff.         0.02468212    0.1948185   0.2294328   0.2681193
## np1 - Icer              -352.23489020 -316.4394659  62.5270100  17.3782837
##                             3rd Qu.         Max.
## standard - Cost         802.3426777  871.8854128
## standard - Effect        29.9639255   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504  711.4055539
## np1 - Effect             30.4095470   31.8353665
## np1 - Cost Diff.         30.5446941  114.7351792
## np1 - Effect Diff.        0.3499204    0.4556047
## 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: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 26663.28 694944.8
## np1      26931.40 661147.7
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -33.79712    0.2681193 -126.0525 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.