Heterogeneity & Demographic Analysis

2017-05-09

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    56     1
##  2    58     0
##  3    47     0
##  4    46     1
##  5    53     1
##  6    84     1
##  7    82     0
##  8    53     0
##  9    66     0
## 10    55     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)
## Loading required namespace: Hmisc
## An analysis re-run on 100 parameter sets.
## 
## * Unweighted analysis.
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.      Median        Mean
## standard - Cost          4.254235e+02  605.0062810 626.9720129 680.2159136
## standard - Effect        4.554756e+00   25.5696426  27.7806580  25.6344564
## standard - Cost Diff.               -            -           -           -
## standard - Effect Diff.             -            -           -           -
## standard - Icer                     -            -           -           -
## np1 - Cost               5.872463e+02  635.5509751 641.5229814 657.0514854
## np1 - Effect             4.561086e+00   25.8299343  27.9754765  25.8862442
## np1 - Cost Diff.        -1.604799e+02 -110.7286273  14.5509685 -23.1644282
## np1 - Effect Diff.       6.330508e-03    0.1948185   0.2168686   0.2517877
## np1 - Icer              -3.522349e+02 -316.4394659  72.7555976 422.9292860
##                             3rd Qu.         Max.
## standard - Cost         802.3426777 8.718854e+02
## standard - Effect        29.0749005 3.190192e+01
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              691.6140504 7.114056e+02
## np1 - Effect             29.5008365 3.214202e+01
## np1 - Cost Diff.         30.5446941 1.618227e+02
## np1 - Effect Diff.        0.3499204 4.556047e-01
## np1 - Icer              156.7853582 2.556236e+04
## 
## * 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 25634.46 680215.9
## np1      25886.24 657051.5
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -23.16443    0.2517877 -91.99983 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    72     0 0.1340435
##  2    46     0 0.5686667
##  3    64     0 0.4968615
##  4    68     1 0.8405735
##  5    69     1 0.6578603
##  6    51     0 0.1789137
##  7    39     1 0.8216278
##  8    70     0 0.3986975
##  9    60     1 0.5536154
## 10    42     1 0.3197799
## # ... 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.03313 0.27929 0.56622 0.53068 0.75901 0.99950 
## 
## Total weight: 53.06804
## 
## * Values distribution:
## 
##                                 Min.      1st Qu.     Median        Mean
## standard - Cost          565.3706618  605.0062810 629.468026 693.0127695
## standard - Effect         14.3082870   25.5711412  27.780658  26.5746917
## standard - Cost Diff.              -            -          -           -
## standard - Effect Diff.            -            -          -           -
## standard - Icer                    -            -          -           -
## np1 - Cost               624.7960167  635.5509751 642.202046 660.6193221
## np1 - Effect              14.4398232   25.8299343  27.975477  26.8415861
## np1 - Cost Diff.        -164.8813733 -110.7286273  14.550969 -32.3934474
## np1 - Effect Diff.         0.1315362    0.1948185   0.221716   0.2668944
## np1 - Icer              -354.3243137 -316.4394659  64.056585 732.2253043
##                             3rd Qu.         Max.
## standard - Cost         828.5434528 8.780434e+02
## standard - Effect        29.9639255 3.159866e+01
## standard - Cost Diff.             -            -
## standard - Effect Diff.           -            -
## standard - Icer                   -            -
## np1 - Cost              699.0605439 7.131620e+02
## np1 - Effect             30.4095470 3.183537e+01
## np1 - Cost Diff.         30.5446941 1.720588e+02
## np1 - Effect Diff.        0.3887769 4.653403e-01
## np1 - Icer              156.7853582 6.796322e+04
## 
## * 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 26574.69 693012.8
## np1      26841.59 660619.3
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -32.39345    0.2668944 -121.3718 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.