Heterogeneity & Demographic Analysis

2016-11-11

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     70     1
## 2     58     1
## 3     71     0
## 4     72     1
## 5     69     0
## 6     60     1
## 7     58     1
## 8     59     1
## 9     62     0
## 10    51     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 model update, using equal weights.
## Updating model 'standard'...
## Updating model '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          489705.61885  613836.464 700765.4220 707842.23619
## standard - Effect          6142.59603   25569.643  27376.9142  26462.35137
## standard - Cost Diff.               -           -           -            -
## standard - Effect Diff.             -           -           -            -
## standard - Icer                     -           -           -            -
## np1 - Cost               604440.79805  637950.820 662887.3683 664792.10704
## np1 - Effect               6167.27815   25829.934  27765.6911  26738.92591
## np1 - Cost Diff.        -160479.85885 -129482.909 -37878.0537 -43050.12914
## np1 - Effect Diff.           24.68212     208.543    231.4481    276.57455
## np1 - Icer                 -352.23489    -333.052   -178.4235    -34.15831
##                             3rd Qu.        Max.
## standard - Cost         828543.4528 871885.4128
## standard - Effect        29074.9005  31598.6556
## standard - Cost Diff.             -           -
## standard - Effect Diff.           -           -
## standard - Icer                   -           -
## np1 - Cost              699060.5439 711405.5539
## np1 - Effect             29500.8365  31835.3665
## np1 - Cost Diff.         24114.3568 114735.1792
## np1 - Effect Diff.         388.7769    455.6047
## np1 - Icer                 115.6325   4648.5141
## 
## * 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'.
## 
##           utility     cost
## standard 26462.35 707842.2
## np1      26738.93 664792.1
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1  -43.05013    0.2765745 -155.6547 standard

The variation of the incremental differences in cost, effect or ICER can then be plotted.

plot(res_h, type = "icer", model = "np1", binwidth = 500)

plot(res_h, type = "effect", model = "np1", binwidth = 50)

plot(res_h, type = "cost", model = "np1", binwidth = 25000)

The results from the combined model can be plotted similarly to the results from run_model().

plot(res_h, type = "counts", model = "np1")

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     57     0 0.56670097
## 2     55     0 0.09616077
## 3     66     1 0.56064040
## 4     57     1 0.19279303
## 5     66     0 0.72781279
## 6     55     0 0.46064354
## 7     47     0 0.89288972
## 8     46     0 0.91552882
## 9     66     0 0.64694395
## 10    59     1 0.97023568
## # ... with 90 more rows
res_w <- update(res_mod, newdata = tab_indiv_w)
## Updating model 'standard'...
## Updating model 'np1'...
res_w
## An analysis re-run on 100 parameter sets.
## 
## * Weigths distribution:
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.01712 0.27250 0.54770 0.51340 0.73020 0.99800 
## 
## Total weight: 51.33572
## 
## * Values distribution:
## 
##                                  Min.      1st Qu.       Median
## standard - Cost          546153.34802  605006.2810 629545.85355
## standard - Effect         14308.28698   24414.3654  27376.91420
## standard - Cost Diff.               -            -            -
## standard - Effect Diff.             -            -            -
## standard - Icer                     -            -            -
## np1 - Cost               619827.71155  635550.9751 642341.30954
## np1 - Effect              14439.82318   24687.7787  27765.69106
## np1 - Cost Diff.        -167834.33856 -118531.7322  14550.96853
## np1 - Effect Diff.           92.03743     194.8185    229.43277
## np1 - Icer                 -355.65309    -323.3515     63.42149
##                                 Mean     3rd Qu.        Max.
## standard - Cost         698290.32147 828543.4528 882175.2204
## standard - Effect        26266.52731  29074.9005  31404.9817
## standard - Cost Diff.              -           -           -
## standard - Effect Diff.            -           -           -
## standard - Icer                    -           -           -
## np1 - Cost              662109.02565 699060.5439 714340.8818
## np1 - Effect             26534.54165  29500.8365  31687.4141
## np1 - Cost Diff.        -36181.29581  30544.6941  95600.1249
## np1 - Effect Diff.         268.01434    388.7769    471.9046
## np1 - Icer                 -21.39138    156.7854   1742.3821
## 
## * 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'.
## 
##           utility     cost
## standard 26266.53 698290.3
## np1      26534.54 662109.0
## 
## Efficiency frontier:
## 
## np1
## 
## Differences:
## 
##     Cost Diff. Effect Diff.      ICER     Ref.
## np1   -36.1813    0.2680143 -134.9976 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.