Heterogeneity & Demographic Analysis

2016-11-23

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 × 2
##      age   sex
##    <dbl> <int>
## 1     50     1
## 2     58     1
## 3     62     0
## 4     55     0
## 5     60     1
## 6     63     1
## 7     70     1
## 8     60     0
## 9     72     1
## 10    35     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          489.70561885  605.0062810 629.4680260 703.0181689
## standard - Effect          6.14259603   25.5696426  27.7806580  26.9626078
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               604.44079805  635.5509751 642.2020458 663.4128120
## np1 - Effect               6.16727815   25.8971558  27.9754765  27.2387785
## np1 - Cost Diff.        -160.47985885 -129.4829089  12.9170193 -39.6053569
## np1 - Effect Diff.         0.02468212    0.1948185   0.2294328   0.2761707
## np1 - Icer              -352.23489020 -333.0519971  58.9827249 -19.2615360
##                             3rd Qu.         Max.
## standard - Cost         828.5434528  871.8854128
## standard - Effect        29.9639255   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439  711.4055539
## np1 - Effect             30.4095470   31.8353665
## np1 - Cost Diff.         30.5446941  114.7351792
## np1 - Effect Diff.        0.3887769    0.4556047
## np1 - Icer              156.7853582 4648.5141231
## 
## * Combined result:
## 
## 2 strategies run for 60 cycles.
## 
## Initial state counts:
## 
##                N
## PrimaryTHR  1000
## SuccessP       0
## RevisionTHR    0
## SuccessR       0
## Death          0
## 
## Counting method: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 26962.61 703018.2
## np1      27238.78 663412.8
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.     ICER     Ref.
## np1  -39.60536    0.2761707 -143.409 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 × 3
##      age   sex   .weights
##    <dbl> <int>      <dbl>
## 1     49     0 0.23960836
## 2     66     1 0.82365143
## 3     59     0 0.03620317
## 4     68     0 0.88769226
## 5     72     0 0.91843492
## 6     62     0 0.21644705
## 7     63     1 0.74616099
## 8     75     1 0.36457295
## 9     54     1 0.42624534
## 10    48     1 0.77364529
## # ... 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.01302 0.21100 0.35800 0.43460 0.69690 0.95450 
## 
## Total weight: 43.46323
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          530.94590166  599.2579319 629.9316751 691.1819325
## standard - Effect          9.32287610   22.2194037  27.3769142  24.7376297
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               615.48340627  633.9898463 642.8128664 660.2096573
## np1 - Effect               9.38064927   22.3561826  27.7656911  24.9932392
## np1 - Cost Diff.        -160.47985885 -117.9338966  14.5509685 -30.9722753
## np1 - Effect Diff.         0.05777317    0.1721907   0.2232944   0.2556095
## np1 - Icer              -352.23489020 -322.8218891  67.7453004  78.7912125
##                             3rd Qu.         Max.
## standard - Cost         828.5434528  882.1752204
## standard - Effect        29.0749005   31.3528570
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439  714.3408818
## np1 - Effect             29.5008365   31.7158136
## np1 - Cost Diff.         41.4434274   84.5375046
## np1 - Effect Diff.        0.3887769    0.4719046
## np1 - Icer              240.6833019 1275.2350079
## 
## * Combined result:
## 
## 2 strategies run for 60 cycles.
## 
## Initial state counts:
## 
##                N
## PrimaryTHR  1000
## SuccessP       0
## RevisionTHR    0
## SuccessR       0
## Death          0
## 
## Counting method: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 24737.63 691181.9
## np1      24993.24 660209.7
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -30.97228    0.2556095 -121.1703 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.