Heterogeneity & Demographic Analysis

2019-02-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    86     1
##  2    83     0
##  3    52     0
##  4    55     1
##  5    60     1
##  6    58     0
##  7    73     1
##  8    53     1
##  9    67     1
## 10    60     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
## standard - Cost          485.85297365  613.8364635  700.7654220
## standard - Effect          6.14259603   22.7930050   25.6577436
## standard - Cost Diff.               -            -            -
## standard - Effect Diff.             -            -            -
## standard - Icer                     -            -            -
## np1 - Cost               603.34263272  637.9508204  662.8873683
## np1 - Effect               6.16727815   23.0848338   25.9195630
## np1 - Cost Diff.        -167.83433856 -110.7286273  -37.8780537
## np1 - Effect Diff.         0.02468212    0.2051119    0.2350871
## np1 - Icer              -355.65308588 -316.4394659 -178.4235124
##                                Mean     3rd Qu.         Max.
## standard - Cost         707.6366618 802.3426777  882.1752204
## standard - Effect        25.3579640  29.0459530   31.5986556
## standard - Cost Diff.             -           -            -
## standard - Effect Diff.           -           -            -
## standard - Icer                   -           -            -
## np1 - Cost              664.8057134 691.6140504  714.3408818
## np1 - Effect             25.6288369  29.2544960   31.8353665
## np1 - Cost Diff.        -42.8309485  24.1143568  117.4896591
## np1 - Effect Diff.        0.2708728   0.3499204    0.4719046
## np1 - Icer               13.5778195 115.6325465 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 25357.96 707636.7
## np1      25628.84 664805.7
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.     ICER     Ref.
## np1  -42.83095    0.2708728 -158.122 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    44     1  0.842  
##  2    53     0  0.857  
##  3    53     0  0.883  
##  4    58     0  0.959  
##  5    67     1  0.322  
##  6    54     0  0.0333 
##  7    76     0  0.00645
##  8    52     1  0.719  
##  9    77     0  0.837  
## 10    65     0  0.882  
## # … 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.000187 0.248291 0.519926 0.517992 0.828006 0.998632 
## 
## Total weight: 51.79923
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          485.85297365  605.0062810 621.9893893 671.0221507
## standard - Effect         11.78433667   25.5696426  27.3769142  25.9877301
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               603.34263272  635.5509751 640.1676766 654.4026522
## np1 - Effect              11.82839436   25.8299343  27.7656911  26.2313015
## np1 - Cost Diff.        -164.88137326 -110.7286273  18.1782873 -16.6194986
## np1 - Effect Diff.         0.04405769    0.1774891   0.2167522   0.2435714
## np1 - Icer              -354.32431375 -316.4394659  82.0897023 108.4122358
##                             3rd Qu.         Max.
## standard - Cost         802.3426777  878.0433890
## standard - Effect        29.0642784   31.3071020
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504  713.1620157
## np1 - Effect             29.4104437   31.5405654
## np1 - Cost Diff.         30.5446941  117.4896591
## np1 - Effect Diff.        0.3499204    0.4653403
## np1 - Icer              156.7853582 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 25987.73 671022.2
## np1      26231.30 654402.7
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1   -16.6195    0.2435714 -68.23256 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.