Longitudinal Models in missingHE

Currently, only longitudinal selection models can be fitted using missingHE, for which the package provides a series of customisation options to allow a flexible specification of the models in terms of modelling assumptions and prior choices. These can be extremely useful for handling the typical features of trial-based CEA data, such as non-normality, clustering, and type of missingness mechanism. This tutorial shows how it is possible to customise different aspects of longitudinal models using the arguments of each type of function in the package. Throughout, we will use the built-in dataset called PBS as a toy example, which is directly available when installing and loading missingHE in your R workspace. See the vignette called Introduction to missingHE for an introductory tutorial of each function in missingHE and a general presentation of the data used in trial-based economics evaluations.

If you would like to have more information on the package, or would like to point out potential issues in the current version, feel free to contact the maintainer at . Suggestions on how to improve the package are also very welcome.

Changing the distributional assumptions

A general concern when analysing trial-based CEA data is that, in many cases, both effectiveness and costs are characterised by highly skewed distributions, which may cause standard normality modelling assumptions to be difficult to justify, especially for small samples. missingHE allows to chose among a range of parametric distributions for modelling both outcome variables, which were selected based on the most common choices in standard practice and the literature. In the context of a trial-based analysis, health economic outcomes are typically collected at baseline and a series of follow-up time points. Traditionally, the analysis is conducted at the aggregate level using cross-sectional effectiveness and cost outcomes obtained by combining the outcomes collected at different times as this considerably simplify the analysis task which does not require a longitudinal model specification. However, such an approach can be justified only when very limited missing outcome values occur throughout the time period of the study. When this is not true, then focussing at the aggregate level may considerably hinder the validity and reliability of the results in terms of either bias or efficiency. To deal with this problem, then a longitudinal model specification is reuiquired which allows to make full use of all observed outcome values collected in the trial while also being able to specify different missingness assumptions based on the different missingness patterns observed across the trial period.

Different approaches are available for modelling longitudinal or repeated measurement binary outcomes under different missingness assumptions, such as longitudinal selection models, which are implemented in missingHE together with a series of customisation options in terms of model specification. Within the model, the specific type of distributions for the effectiveness or utility (u) and cost (c) outcome at each time point of the analysis can be selected by setting the arguments dist_u and dist_c to specific character names. Available choices include: Normal ("norm") and Beta ("beta") distributions for u and Normal ("norm") and Gamma ("gamma") for c. Distributions for modelling both discrete and binary effectiveness variables are also available, such as Poisson ("pois") and Bernoulli (bern) distributions. The full list of available distributions for each type of outcome can be seen by using the help function on each function of the package.

In the PBS dataset the longitudinal health economic variables are the utilities (from EQ5D-3L questionnaires) and costs (from clinic records) collected at baseline (time = 1) and two follow-up times (6 months, time = 2; and 12 months, time = 3). To have an idea of what the data look like, we can inspect the first entries for each variable at a specific time (e.g. time = 1) by typing

> #first 10 entries of u and c at time 1
> head(PBS$u[PBS$time == 1], n = 10)
 [1]  0.17300001  0.85000002 -0.16599999  0.25800008  0.03800001  1.00000000
 [7]  0.41400003  0.71000004  0.88300002  0.81500006
> head(PBS$c[PBS$time == 1], n = 10)
 [1]  9214.0  2492.5 15283.0  1858.0   797.0   358.0   803.0   336.0   472.0
[10]   959.0

We can check the empirical histograms of the data at different times, for example u at time 1 and 2 by treatment group by typing

> par(mfrow=c(2, 2))
> hist(PBS$u[PBS$t==1 & PBS$time == 1], main = "Utility at time 1 - Control")
> hist(PBS$u[PBS$t==2 & PBS$time == 1], main = "Utility at time 1 - Intervention")
> hist(PBS$u[PBS$t==1 & PBS$time == 2], main = "Utility at time 2 - Control")
> hist(PBS$u[PBS$t==2 & PBS$time == 2], main = "Utility at time 2 - Intervention")

We can also see that the proportion of missing values in u at each time is moderate in both treatment groups.

> #proportions of missing values in the control group 
> sum(is.na(PBS$u[PBS$t==1 & PBS$time == 1])) / length(PBS$u[PBS$t==1 & PBS$time == 1])  
[1] 0.06617647
> sum(is.na(PBS$u[PBS$t==1 & PBS$time == 2])) / length(PBS$u[PBS$t==1 & PBS$time == 2])
[1] 0.125
> sum(is.na(PBS$u[PBS$t==1 & PBS$time == 3])) / length(PBS$u[PBS$t==1 & PBS$time == 3])
[1] 0.08088235
> 
> #proportions of missing values in the intervention group
> sum(is.na(PBS$u[PBS$t==2 & PBS$time == 1])) / length(PBS$u[PBS$t==2 & PBS$time == 1])
[1] 0.0462963
> sum(is.na(PBS$u[PBS$t==2 & PBS$time == 2])) / length(PBS$u[PBS$t==2 & PBS$time == 2])  
[1] 0.05555556
> sum(is.na(PBS$u[PBS$t==2 & PBS$time == 3])) / length(PBS$u[PBS$t==2 & PBS$time == 3])  
[1] 0.0462963

As an example, we fit a longitudinal selection model assuming Normal distributions to handle u, and we choose Gamma distributions to capture the skewness in the costs. We note that, in case some of individuals have costs that are equal to zero (as in the PBS dataset), standard parametric distributions with a positive support are not typically defined at 0 (e.g. the Gamma distributions), making their implementation impossible. Thus, in these cases, it is necessary to use a trick to modify the boundary values before fitting the model. A common approach is to add a small constant to the cost variables. These can be done by typing

> PBS$c <- PBS$c + 0.01

We note that, although simple, this strategy has the potential drawback that results may be affected by the choice of the constant added and therefore sensitivity analysis to the value used is typically recommended.

We are now ready to fit our longitudinal selection model to the PBS dataset using the following command

> NN.sel=selection_long(data = PBS, model.eff = u ~ 1, model.cost = c ~ u, 
+   model.mu = mu ~ gender, 
+   model.mc = mc ~ gender, type = "MAR", 
+   n.iter = 500, dist_u = "norm", dist_c = "norm", time_dep = "none")

The arguments dist_u = "norm" and dist_c = "norm" specify the distributions assumed for the outcome variables and, in the model of c, we also take into account the possible association between the two outcomes at each time by uncluding the utility as a covariate (u). According to the type of distributions chosen, missingHE automatically models the dependence between covariates and the mean outcome on a specific scale to reduce the chance of incurring into numerical problems due to the constraints of the distributions. For example, for both Poisson and Gamma distributions means are modelled on the log scale, while for Beta and Bernoulli distirbutions they are modelled on the logit scale. To see the modelling scale used by missingHE according to the type of distribution selected, use the help command on each function of the package. The optional argument time_dep allows to specify the type of time dependence structure assumed by the model, here corresponding to no temporal dependence ("none"). An alternative choice available in missingHE is to set time_dep = "AR1", which assumes an autoregressive of order one time structure.

The model assumes MAR conditional on gender as auxiliary variable for predicting missingness in both outcomes. We can look at how the model generate imputations for the outcomes by treatment group using the generic function plot. For example, we can look at how the missing u at time 3 are imputed by typing

> plot(NN.sel, outcome = "effects", time_plot = 3)

Summary results of our model from a statistical perspective can be inspected using the command coef, which extracts the estimates of the mean regression coefficients for u and c by treatment group and time point. By default, the lower and upper bounds provide the 95% credibile intervals for each estimate (based on the 0.025 and 0.975 quantiles of the posterior distribution). For example, we can inspect the coefficients in the utility and cost models at time 2 by typing

> coef(NN.sel, time = 2)
$Comparator
$Comparator$Effects
             mean    sd lower upper
(Intercept) 0.504 0.031 0.442 0.564

$Comparator$Costs
                 mean      sd     lower     upper
(Intercept)  1448.153 157.448  1156.635  1749.163
u           -2073.721 419.749 -2839.325 -1255.118


$Reference
$Reference$Effects
             mean    sd lower upper
(Intercept) 0.636 0.033 0.571 0.701

$Reference$Costs
                 mean      sd     lower    upper
(Intercept)  2846.640 215.281  2437.152 3294.455
u           -1890.042 606.877 -3081.988 -686.527

The entire posterior distribution for each parameter of the model can also be extracted from the output of the model by typing NN.sel$model_output, which returns a list object containing the posterior estimates for each model parameter. An overall summary of the economic analysis based on the model estimates can be obtained using the summary command

> summary(NN.sel)

 Cost-effectiveness analysis summary 
 
 Comparator intervention: intervention 1 
 Reference intervention: intervention 2 
 
 Parameter estimates under MAR assumption
 
 Comparator intervention 
                         mean      sd       LB       UB
mean effects (t = 1)    0.493   0.019     0.46    0.523
mean costs (t = 1)   2861.854 362.098 2257.394 3433.728

 Reference intervention 
                         mean      sd       LB       UB
mean effects (t = 2)    0.613   0.021     0.58    0.647
mean costs (t = 2)   5708.719 283.682 5248.358 6195.388

 Incremental results 
                  mean     sd       LB       UB
delta effects     0.12  0.028    0.072    0.167
delta costs   2846.865 470.27 2085.693 3650.356
ICER           23714.7                         

which shows summary statistics for the mean effectiveness and costs in each treatment group, for the mean differentials and the estimate of the ICER. It is important to clarify how these results are obtained in that they pertain summary statistics for aggregated health economic outcomes (e.g. QALYs and Total costs) which are retrieved by combining the posterior results from the longitudinal model for each type of outcome and time point of the analysis. More specifically, the function selection_long, after deriving the posterior results from the model, applies common CEA techniques for computing aggregate variables based on the posterior mean results of the effectiveness and cost variables at each time point of the analysis. These include: Area Under the Curve approach for u and total sum over the follow-up period for c. By default, missingHE assumes a value of 0.5 and 1 for the weights used to respectively calculate the aggregate mean QALYs and Total costs over the time period of the study. When desired, users can provide their own weights as additional argument named qaly_calc and tcost_calc that can be passed into the function selection_long when fitting the model.

Including random effects terms

For each type of model, missingHE allows the inclusion of random effects terms to handle clustered data. To be precise, the term random effects does not have much meaning within a Bayesian approach since all parameters are in fact random variables. However, this terminology is quite useful to explain the structure of the model.

We show how random effects can be added to the model of u and c within a longitudinal selection model fitted to the PBS dataset using the function selection_long. The clustering variable over which the random effects are specified is the factor variable site, representing the centres at which data were collected in the trial. Using the same distributional assumptions of the selection model, we fit the pattern mixture model by typing

> PBS$site <- factor(PBS$site)
> NN.re=selection_long(data = PBS, model.eff = u ~ 1 + (1 | site), 
+                model.cost = c ~ u + (1 | site), model.mu = mu ~ gender, 
+                model.mc = mc ~ gender, type = "MAR", 
+                n.iter = 500, dist_u = "norm", dist_c = "norm", time_dep = "none")

The function fits a random intercept only model for u and c, as indicated by the notation (1 | site)and (1 | site). In both models, site is the clustering variable over which the random coefficients are estimated. missingHE allows the user to choose among different clustering variables for the model of u and c if these are available in the dataset. Random intercept and slope models can be specified using the notation (1 + gender | site), where gender is the name of a covariate which should be inlcuded as fixed effects in the corresponding outcome model. Finally, it is also possible to specify random slope only models using the notation (0 + gender | site), where 0 indicates the removal of the random intercept.

Coefficient estimates for the random effects at each time can be extracted using the coef function and setting the argument random = TRUE (if set to FALSE then the fixed effects estimates are displayed).

> coef(NN.re, time = 3, random = TRUE)
$Comparator
$Comparator$Effects
                mean    sd lower upper
(Intercept) 1  4.635 0.676 3.818 5.462
(Intercept) 2  4.650 0.678 3.845 5.516
(Intercept) 3  4.604 0.674 3.709 5.404
(Intercept) 4  4.671 0.682 3.867 5.523
(Intercept) 5  4.622 0.685 3.737 5.439
(Intercept) 6  4.623 0.681 3.737 5.440
(Intercept) 7  4.598 0.680 3.663 5.413
(Intercept) 8  4.627 0.675 3.789 5.435
(Intercept) 9  4.637 0.678 3.779 5.473
(Intercept) 10 4.707 0.686 3.941 5.623
(Intercept) 11 4.622 0.677 3.772 5.433
(Intercept) 12 4.625 0.673 3.782 5.429

$Comparator$Costs
                 mean     sd    lower   upper
(Intercept) 1   7.726 65.620 -136.553 139.105
(Intercept) 2  -2.105 68.131 -137.221 125.201
(Intercept) 3  -1.082 67.491 -143.695 128.822
(Intercept) 4   4.233 69.744 -132.005 151.252
(Intercept) 5  18.072 67.626 -114.396 163.039
(Intercept) 6   4.440 67.231 -152.236 149.833
(Intercept) 7   3.363 68.470 -127.593 151.735
(Intercept) 8   6.120 65.449 -126.436 130.844
(Intercept) 9   4.432 65.158 -137.624 146.135
(Intercept) 10 -1.508 67.585 -154.240 135.239
(Intercept) 11 -0.993 69.735 -145.145 136.460
(Intercept) 12  4.574 70.437 -159.128 165.297


$Reference
$Reference$Effects
                mean    sd  lower upper
(Intercept) 1  0.372 0.510 -0.554 1.292
(Intercept) 2  0.429 0.500 -0.456 1.318
(Intercept) 3  0.367 0.507 -0.582 1.293
(Intercept) 4  0.380 0.509 -0.558 1.302
(Intercept) 5  0.345 0.509 -0.585 1.282
(Intercept) 6  0.340 0.506 -0.577 1.276
(Intercept) 7  0.404 0.502 -0.532 1.300
(Intercept) 8  0.414 0.503 -0.529 1.308
(Intercept) 9  0.312 0.517 -0.661 1.272
(Intercept) 10 0.333 0.515 -0.637 1.279
(Intercept) 11 0.416 0.500 -0.520 1.308

$Reference$Costs
                  mean     sd    lower   upper
(Intercept) 1    3.355 68.346 -106.461 143.740
(Intercept) 2  -10.237 63.738 -134.288 127.368
(Intercept) 3   -1.813 67.137 -147.782 150.758
(Intercept) 4   -3.399 69.610 -137.511 136.837
(Intercept) 5  -18.556 67.955 -159.122 104.508
(Intercept) 6    6.949 71.076 -124.654 153.351
(Intercept) 7  -11.404 64.234 -130.639 127.792
(Intercept) 8   -1.167 70.600 -132.543 165.908
(Intercept) 9   -8.141 63.993 -134.325 132.979
(Intercept) 10   8.008 68.586  -99.191 168.593
(Intercept) 11  -8.587 68.409 -147.711 141.537

For both u and c models, summary statistics for the random coefficient estimates are displayed for each treatment group and each of the clusters in site.

Changing the priors

By default, all models in missingHE are fitted using vague prior distributions so that posterior results are essentially derived based on the information from the observed data alone. This ensures a rough approximation to results obtained under a frequentist approach based on the same type of models.

However, in some cases, it may be reasonable to use more informative priors to ensure a better stability of the posterior estimates by restricting the range over which estimates can be obtained. For example if, based on previous evidence or knowledge, the range over which a specific parameter is likely to vary is known, then priors can be specified so to give less weight to values outside that range when deriving the posterior estimates. However, unless the user is familiar with the choice of informative priors, it is generally recommended not to change the default priors of missingHE as the unintended use of informative priors may substantially drive posterior estimates and lead to incorrect results.

For each type of model in missingHE, priors can be modified using the argument prior, which allows to change the hyperprior values for each model parameter. The interpretation of the prior values change according to the type of parameter and model considered. For example, we can fit a longitudinal selection model to the PBS dataset using more informative priors on some parameters.

Prior values can be modified by first creating a list object which, for example, we call my.prior. Within this list, we create a number of elements (vectors of length two) which should be assigned specific names based on the type of parameters which priors we want to change.

> my.prior <- list(
+   "alpha0.prior" = c(0 , 0.0000001),
+   "beta0.prior" = c(0, 0.0000001),
+   "gamma0.prior.c"= c(0, 1),
+   "gamma.prior.c" = c(0, 0.01),
+   "sigma.prior.c" = c(0, 100)
+ )

The names above have the following interpretations in terms of the model parameters:

  • "alpha0.prior" is the intercept of the model of u. The first and second elements inside the vector for this parameter are the mean and precision (inverse of variance) that should be used for the normal prior given to this parameter by missingHE.

  • "beta0.prior" is the intercept of the model of c. The first and second elements inside the vector for this parameter are the mean and precision (inverse of variance) that should be used for the normal prior given to this parameter by missingHE.

  • "gamma0.prior.c" is the intercept of the model of mc. The first and second elements inside the vector for this parameter are the mean and precision (inverse of variance) that should be used for the logistic prior given to this parameter by missingHE.

  • "gamma.prior.c" are the regression coefficients (exclusing the intercept) of the model of mc. The first and second elements inside the vector for this parameter are the mean and precision (inverse of variance) that should be used for the normal priors given to each coefficient by missingHE.

  • "sigma.prior.c" is the standard deviation of the model of c. The first and second elements inside the vector for this parameter are the lower and upper bounds that should be used for the uniform prior given to this parameter by missingHE.

The values shown above are the default values set in missingHE for each of these parameters. It is possible to change the priors by providing different values, for example by increasing the precision for some of the coefficient estimates or decreasing the upper bound for standard deviation parameters. Different names should be used to indicate for which parameter the prior should be modified, keeping in mind that the full list of names that can be used varies depending on the type of models and modelling assumptions specified. The full list of parameter names for each type of model can be assessed using the helpcommand on each function of missingHE.

We can now fit the hurdle model using our priors by typing

> NN.prior=selection_long(data = PBS, model.eff = u ~ 1 + (1 | site), 
+                model.cost = c ~ u + (1 | site), model.mu = mu ~ gender, 
+                model.mc = mc ~ gender, type = "MAR", 
+                n.iter = 500, dist_u = "norm", dist_c = "norm", time_dep = "none",
+                prior = my.prior)

Finally, we can inspect the statistical results from the model at time 3 by typing

> coef(NN.prior, random = FALSE, time = 3)
$Comparator
$Comparator$Effects
             mean    sd lower upper
(Intercept) 2.981 1.442 1.364 4.589

$Comparator$Costs
                 mean      sd     lower    upper
(Intercept)  1411.651 325.638   806.228 2087.304
u           -1555.113 944.963 -3428.727   97.773


$Reference
$Reference$Effects
             mean  sd  lower upper
(Intercept) -0.18 1.3 -1.712 1.259

$Reference$Costs
                 mean      sd     lower    upper
(Intercept)  2860.912 197.426  2473.895 3261.136
u           -1062.262 565.266 -2125.335   48.886

and

> coef(NN.prior, random = TRUE, time = 3)
$Comparator
$Comparator$Effects
                 mean    sd  lower  upper
(Intercept) 1  -2.492 1.439 -4.119 -0.878
(Intercept) 2  -2.473 1.438 -4.112 -0.864
(Intercept) 3  -2.546 1.450 -4.219 -0.903
(Intercept) 4  -2.430 1.430 -4.056 -0.813
(Intercept) 5  -2.519 1.446 -4.162 -0.901
(Intercept) 6  -2.514 1.447 -4.172 -0.889
(Intercept) 7  -2.564 1.451 -4.239 -0.904
(Intercept) 8  -2.516 1.437 -4.146 -0.892
(Intercept) 9  -2.494 1.442 -4.160 -0.886
(Intercept) 10 -2.366 1.420 -4.044 -0.691
(Intercept) 11 -2.517 1.446 -4.176 -0.891
(Intercept) 12 -2.518 1.445 -4.153 -0.893

$Comparator$Costs
                  mean     sd    lower   upper
(Intercept) 1   -4.560 80.492 -142.787 165.482
(Intercept) 2   -3.287 77.501 -152.019 157.161
(Intercept) 3  -15.488 82.948 -171.837 151.292
(Intercept) 4   -8.533 79.237 -168.581 151.898
(Intercept) 5    4.628 80.269 -150.752 167.905
(Intercept) 6   -6.685 78.744 -168.593 140.419
(Intercept) 7  -14.400 80.171 -185.621 142.453
(Intercept) 8  -10.620 83.257 -178.595 151.524
(Intercept) 9  -12.724 77.712 -162.921 158.280
(Intercept) 10  -7.962 80.090 -163.285 157.817
(Intercept) 11  -6.484 84.996 -173.156 151.661
(Intercept) 12  -2.664 82.525 -161.226 164.044


$Reference
$Reference$Effects
                mean    sd  lower upper
(Intercept) 1  0.796 1.305 -0.672 2.349
(Intercept) 2  0.861 1.303 -0.606 2.397
(Intercept) 3  0.790 1.304 -0.680 2.355
(Intercept) 4  0.811 1.302 -0.675 2.347
(Intercept) 5  0.760 1.298 -0.700 2.319
(Intercept) 6  0.761 1.305 -0.697 2.310
(Intercept) 7  0.837 1.302 -0.621 2.366
(Intercept) 8  0.850 1.296 -0.605 2.366
(Intercept) 9  0.731 1.304 -0.766 2.304
(Intercept) 10 0.754 1.309 -0.730 2.323
(Intercept) 11 0.845 1.297 -0.614 2.362

$Reference$Costs
                 mean     sd    lower   upper
(Intercept) 1  20.131 69.449 -121.088 181.867
(Intercept) 2   2.035 66.828 -139.911 154.987
(Intercept) 3   7.199 68.527 -140.102 158.432
(Intercept) 4   7.948 64.674 -115.997 132.487
(Intercept) 5  -8.983 67.005 -154.540 118.738
(Intercept) 6   6.434 62.641 -119.441 144.837
(Intercept) 7  -6.822 66.061 -161.154 104.059
(Intercept) 8   1.052 64.179 -142.258 122.575
(Intercept) 9  -1.451 65.187 -126.547 125.838
(Intercept) 10 17.386 70.230 -135.632 179.546
(Intercept) 11 -2.656 66.891 -149.501 119.275