Heterogeneity & Demographic Analysis

2017-09-14

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    68     1
##  2    66     0
##  3    39     0
##  4    65     0
##  5    59     0
##  6    51     0
##  7    61     0
##  8    62     1
##  9    81     1
## 10    49     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)
## Loading required namespace: Hmisc
## An analysis re-run on 100 parameter sets.
## 
## * Unweighted analysis.
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          530.94590166  605.0062810 628.2200194 693.8935412
## standard - Effect          9.32287610   25.5696426  27.7806580  26.1142311
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               615.48340627  635.5509751 641.8625136 660.8481349
## np1 - Effect               9.38064927   25.8299343  27.9754765  26.3768348
## np1 - Cost Diff.        -160.47985885 -110.7286273  13.8254937 -33.0454063
## np1 - Effect Diff.         0.05777317    0.1948185   0.2214442   0.2626037
## np1 - Icer              -352.23489020 -316.4394659  63.4214929 -14.2775877
##                             3rd Qu.         Max.
## standard - Cost         802.3426777  871.8854128
## standard - Effect        29.0749005   31.5986556
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504  711.4055539
## np1 - Effect             29.5008365   31.8353665
## np1 - Cost Diff.         30.5446941   84.5375046
## np1 - Effect Diff.        0.3499204    0.4556047
## 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: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 26114.23 693893.5
## np1      26376.83 660848.1
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -33.04541    0.2626037 -125.8375 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    67     0 0.19400904
##  2    38     1 0.53170742
##  3    62     1 0.50132859
##  4    61     0 0.70009269
##  5    50     0 0.08654152
##  6    54     1 0.26108806
##  7    59     1 0.36437873
##  8    56     0 0.73835406
##  9    70     0 0.51974132
## 10    64     0 0.91512568
## # ... 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.0003859 0.2655726 0.5276766 0.5204712 0.7428900 0.9873446 
## 
## Total weight: 52.04712
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          546.15334802  605.0062810 624.5980862 691.8267606
## standard - Effect         17.56922957   25.6577436  27.7806580  27.0377945
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               619.82771155  635.5509751 640.8772585 660.2492759
## np1 - Effect              17.66126700   25.8299343  27.9754765  27.3050061
## np1 - Cost Diff.        -164.88137326 -115.1962826  18.1782873 -31.5774847
## np1 - Effect Diff.         0.09203743    0.1948185   0.2214442   0.2672116
## np1 - Icer              -354.32431375 -320.3969122  82.0897023 -14.6567208
##                             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.         30.5446941   84.5375046
## np1 - Effect Diff.        0.3887769    0.4653403
## 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: 'end'.
## 
## Values:
## 
##           utility     cost
## standard 27037.79 691826.8
## np1      27305.01 660249.3
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -31.57748    0.2672116 -118.1741 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.