Heterogeneity & Demographic Analysis

2019-02-07

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    61     0
##  2    53     1
##  3    59     1
##  4    51     1
##  5    72     0
##  6    71     0
##  7    74     1
##  8    68     1
##  9    60     0
## 10    46     1
## # … 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          450.15881156  611.6289179 633.0955487 702.4054888
## standard - Effect          7.47256790   24.8754832  27.5787861  26.5086356
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               593.80297968  637.3508591 643.1891043 663.2927048
## np1 - Effect               7.49009703   25.1436592  27.8705838  26.7828586
## np1 - Cost Diff.        -155.93829747 -129.4829089  10.0935556 -39.1127840
## np1 - Effect Diff.         0.01752913    0.2051119   0.2294328   0.2742231
## np1 - Icer              -349.93447295 -333.0519971  42.1744509  56.1590428
##                             3rd Qu.         Max.
## standard - Cost         828.5434528  865.5323779
## standard - Effect        29.2971568   31.9019192
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439  709.5940804
## np1 - Effect             29.7280141   32.1420157
## np1 - Cost Diff.         25.7219412  143.6441681
## np1 - Effect Diff.        0.3887769    0.4456214
## np1 - Icer              125.9207494 8194.5991768
## 
## * 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 26508.64 702405.5
## np1      26782.86 663292.7
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -39.11278    0.2742231 -142.6313 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    52     0  0.242  
##  2    80     0  0.0588 
##  3    59     1  0.00756
##  4    42     1  0.669  
##  5    67     1  0.540  
##  6    69     0  0.532  
##  7    68     0  0.144  
##  8    70     1  0.828  
##  9    65     0  0.288  
## 10    61     1  0.851  
## # … 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.00756 0.29967 0.54075 0.52547 0.76437 0.97849 
## 
## Total weight: 52.54664
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          485.85297365  613.8364635 630.0317060 699.7521913
## standard - Effect         11.78433667   25.5696426  27.7806580  26.4483396
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               603.34263272  637.9508204 642.7626632 662.5098137
## np1 - Effect              11.82839436   25.8299343  27.9754765  26.7185468
## np1 - Cost Diff.        -160.47985885 -110.7286273  12.7340198 -37.2423776
## np1 - Effect Diff.         0.04405769    0.1948185   0.2214442   0.2702072
## np1 - Icer              -352.23489020 -316.4394659  54.5439570 -10.1404799
##                             3rd Qu.         Max.
## standard - Cost         802.3426777  871.8854128
## standard - Effect        29.2087467   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504  711.4055539
## np1 - Effect             29.6376464   31.8353665
## np1 - Cost Diff.         24.1143568  117.4896591
## np1 - Effect Diff.        0.3499204    0.4556047
## 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 26448.34 699752.2
## np1      26718.55 662509.8
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -37.24238    0.2702072 -137.8289 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.