| Title: | Missing Outcome Data in Health Economic Evaluation |
|---|---|
| Description: | Contains a suite of functions for health economic evaluations with missing outcome data. The package can fit different types of statistical models under a fully Bayesian approach using the software 'JAGS' (which should be installed locally and which is loaded in 'missingHE' via the 'R' package 'R2jags'). Three classes of models can be fitted under a variety of missing data assumptions: selection models, pattern mixture models and hurdle models. In addition to model fitting, 'missingHE' provides a set of specialised functions to assess model convergence and fit, and to summarise the statistical and economic results using different types of measures and graphs. The methods implemented are described in Mason (2018) <doi:10.1002/hec.3793>, Molenberghs (2000) <doi:10.1007/978-1-4419-0300-6_18> and Gabrio (2019) <doi:10.1002/sim.8045>. |
| Authors: | Andrea Gabrio [aut, cre] |
| Maintainer: | Andrea Gabrio <[email protected]> |
| License: | GPL-2 |
| Version: | 1.6.1 |
| Built: | 2026-06-01 17:16:43 UTC |
| Source: | https://github.com/angabrio/missinghe |
An internal function to detect the random effects component from an object of class formula
anyBars(term)anyBars(term)
term |
formula to be processed |
#Internal function only #no examples # ##Internal function only #no examples # #
missingHE
Produces a table printout with summary statistics for the regression coefficients of the health economic evaluation probabilistic model
run using the function selection, pattern, hurdle or lmdm.
## S3 method for class 'missingHE' coef(object, prob = c(0.025, 0.975), random = FALSE, digits = 3, ...)## S3 method for class 'missingHE' coef(object, prob = c(0.025, 0.975), random = FALSE, digits = 3, ...)
object |
A |
prob |
A numeric vector of probabilities within the range (0,1), representing the upper and lower CI sample quantiles to be calculated and returned for the estimates. |
random |
Logical. If |
digits |
Integer indicating the number of decimal places to be used for rounding (default = 3). |
... |
Additional arguments affecting the summary produced. |
Prints a table with some summary statistics, including posterior mean, standard deviation and lower and upper quantiles based on the
values specified in prob, for the posterior distributions of the regression coefficients of the effects and costs models run using the
function selection, pattern, hurdle or lmdm.
Andrea Gabrio
selection pattern hurdle lmdm diagnostic plot.missingHE
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # #
This internal function imports the data and outputs only those variables that are needed to run the hurdle model according to the information provided by the user.
data_read_hurdle( data, model.eff, model.cost, model.se, model.sc, se, sc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )data_read_hurdle( data, model.eff, model.cost, model.se, model.sc, se, sc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )
data |
A data frame in which to find variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.se |
A formula expression in conventional |
model.sc |
A formula expression in conventional |
se |
Structural value to be found in the effect data defined in |
sc |
Structural value to be found in the cost data defined in |
cov_matrix |
Covariance matrix containing all model covariates. |
type |
Type of structural value mechanism assumed, either 'SCAR' (Structural Completely At Random) or 'SAR' (Strcutural At Random). |
center |
Logical. If |
fixed_e |
Formula of the fixed effects specified in the effectiveness model. |
fixed_c |
Formula of the fixed effects specified in the cost model. |
random_e |
Formula of the random effects specified in the effectiveness model. |
random_c |
Formula of the random effects specified in the cost model. |
trt_lev |
Levels of the treatment indicator factor. |
trt_pos |
Numeric position of the treatment indicator within the model formula. |
#Internal function only #no examples # ##Internal function only #no examples # #
This internal function imports the data and outputs only those variables that are needed to run the model according to the information provided by the user.
data_read_lmdm( data, model.eff, model.cost, model.me, model.mc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )data_read_lmdm( data, model.eff, model.cost, model.me, model.mc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )
data |
A data frame in which to find variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.me |
A formula expression in conventional |
model.mc |
A formula expression in conventional R linear modelling syntax. The response must be indicated with the
term 'mc'(missing costs) and any covariates used to estimate the probability of missing costs should be given on the right-hand side.
If there are no covariates, specify |
cov_matrix |
Data frame containing the covariate matrix of the model. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
center |
Logical. If |
fixed_e |
Fixed effects variables to be included in the effects model |
fixed_c |
Fixed effects variables to be included in the costs model |
random_e |
Random effects variables to be included in the effects model |
random_c |
Random effects variables to be included in the costs model |
trt_lev |
Vector of names of each treatment factor level |
trt_pos |
Vector of name indices of each treatment factor level |
#Internal function only #no examples # ##Internal function only #no examples # #
This internal function imports the data and outputs only those variables that are needed to run the model according to the information provided by the user.
data_read_pattern( data, model.eff, model.cost, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )data_read_pattern( data, model.eff, model.cost, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )
data |
A data frame in which to find variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
cov_matrix |
Data frame containing the covariate matrix of the model. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
center |
Logical. If |
fixed_e |
Fixed effects variables to be included in the effects model |
fixed_c |
Fixed effects variables to be included in the costs model |
random_e |
Random effects variables to be included in the effects model |
random_c |
Random effects variables to be included in the costs model |
trt_lev |
Vector of names of each treatment factor level |
trt_pos |
Vector of name indices of each treatment factor level |
#Internal function only #no examples # ##Internal function only #no examples # #
This internal function imports the data and outputs only those variables that are needed to run the model according to the information provided by the user.
data_read_selection( data, model.eff, model.cost, model.me, model.mc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )data_read_selection( data, model.eff, model.cost, model.me, model.mc, cov_matrix, type, center, fixed_e, fixed_c, random_e, random_c, trt_lev, trt_pos )
data |
A data frame in which to find variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.me |
A formula expression in conventional |
model.mc |
A formula expression in conventional R linear modelling syntax. The response must be indicated with the
term 'mc'(missing costs) and any covariates used to estimate the probability of missing costs should be given on the right-hand side.
If there are no covariates, specify |
cov_matrix |
Data frame containing the covariate matrix of the model. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
center |
Logical. If |
fixed_e |
Fixed effects variables to be included in the effects model |
fixed_c |
Fixed effects variables to be included in the costs model |
random_e |
Random effects variables to be included in the effects model |
random_c |
Random effects variables to be included in the costs model |
trt_lev |
Vector of names of each treatment factor level |
trt_pos |
Vector of name indices of each treatment factor level |
#Internal function only #no examples # ##Internal function only #no examples # #
JAGS using the function selection, pattern, hurdle or lmdm.The focus is restricted to full Bayesian models in cost-effectiveness analyses based on the function selection, pattern,
hurdle and lmdm, with convergence of the MCMC chains that is assessed through graphical checks of the posterior distribution of the parameters of interest,
Examples are density plots, trace plots, autocorrelation plots, etc. Other types of posterior checks are related to some summary MCMC statistics
that are able to detect possible issues in the convergence of the algorithm, such as the potential scale reduction factor or the effective sample size.
Different types of diagnostic tools and statistics are used to assess model convergence using functions contained in the package ggmcmc.
Graphics and plots are managed using functions contained in the package ggplot2 and ggthemes.
diagnostic(x, type = "denplot", param = "all", theme = NULL, ...)diagnostic(x, type = "denplot", param = "all", theme = NULL, ...)
x |
An object of class "missingHE" containing the posterior results of a full Bayesian model implemented using the function |
type |
Type of diagnostic check to be plotted for the model parameter selected. Available choices include: 'histogram' for histogram plots, 'denplot' for density plots, 'traceplot' for trace plots, 'acf' for autocorrelation plots, 'running' for running mean plots, 'compare' for comparing the distribution of the whole chain with only its last part, 'cross' for cross correlation plots, 'Rhat' for the potential scale reduction factor, 'geweke' for the geweke diagnostic, 'pairs' for posterior correlation among the parameters,'caterpillar' for caterpillar plots. |
param |
Name of the family of parameters to process, as given by a regular expression. For example the mean parameters for the effect and cost variables can be specified using 'mu.e' and 'mu.c', respectively. Different types of models may have different parameters depending on the assumed distributions and missing data assumptions. To see a complete list of all possible parameters by types of models assumed see details. |
theme |
Type of ggplot theme among some pre-defined themes, mostly taken from the package ggthemes. For a full list of available themes see details. |
... |
Additional parameters that can be provided to manage the graphical output of |
Depending on the types of plots specified in the argument type, the output of diagnostic can produce
different combinations of MCMC visual posterior checks for the family of parameters indicated in the argument param.
For a full list of the available plots see the description of the argument type or see the corresponding plots in the package ggmcmc.
The parameters that can be assessed through diagnostic are only those included in the object x (see Arguments). Specific character names
must be specified in the argument param according to the specific model implemented. The available names and the parameters associated with them are:
"mu.e" the mean of the effects across treatment arms.
"mu.c" the mean of the costs across treatment arms.
"sd.e" the standard deviation of the effects.
"sd.c" the standard deviation of the costs.
"alpha" the regression coefficients for the effects.
"beta" the regression coefficients for the costs.
"beta.f" the regression coefficients for the costs related to the effects predictor.
"alpha.time" the autoregressive coefficients for the effects (only with the function lmdm).
"beta.time" the autoregressive coefficients for the costs (only with the function lmdm).
"random.alpha" the regression random effects coefficients for the effects.
"random.beta" the regression random effects coefficients for the costs.
"random.alpha.time" the autoregressive random effects coefficients for the effects (only with the function lmdm).
"random.beta.time" the autoregressive random effects coefficients for the costs (only with the function lmdm).
"p.e" the probability of missingness or structural values for the effects (only with the function selection, hurdle or lmdm).
"p.c" the probability of missingness or structural values for the costs (only with the function selection, hurdle or lmdm).
"gamma.e" the regression coefficients of missingness or structural values for the effects (only with the function selection, hurdle).
"gamma.c" the regression coefficientd of missingness or structural values for the costs (only with the function selection, hurdle).
"random.gamma.e" the random effects regression coefficients of missingness or structural values for the effects (only with the function selection, hurdle or lmdm).
"random.gamma.c" the random effects regression coefficients of missingness or structural values for the costs (only with the function selection, hurdle or lmdm).
"pattern" the probabilities of the missingness patterns (only with the function pattern).
"delta.e" the mnar parameter for the effects (only with the function selection, pattern or lmdm).
"delta.c" the mnar parameters for the costs (only with the function selection, pattern or lmdm).
"random.delta.e" the random effects mnar parameters for the effects (only with the function selection or lmdm).
"random.delta.c" the random effects mnar parameters for the costs (only with the function selection or lmdm).
"all" all available parameters stored in x.
When the object x is created using the function pattern, pattern-specific standard deviation ("sd.e", "sd.c") and regression coefficient
parameters ("alpha", "beta") for both outcomes can be visualised. The parameters associated with a missingness mechanism can be accessed only when x
is created using the function selection, pattern or lmdm, while the parameters associated with the model for the structural values mechanism
can be accessed only when x is created using the function hurdle.
The argument theme allows to customise the graphical output of the plots generated by diagnostic and
allows to choose among a set of possible pre-defined themes taken form the package ggtheme. For a complete list of the available character names
for each theme, see ggthemes.
A ggplot object containing the plots specified in the argument type
Andrea Gabrio
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
Brooks, S. Gelman, A. Jones, JL. Meng, XL. (2011). Handbook of Markov Chain Monte Carlo, CRC/Chapman and Hall.
ggs selection pattern hurdle lmdm.
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # #
An internal function to extract the random effects component from an object of class formula
fb(term)fb(term)
term |
formula to be processed |
#Internal function only #no examples # ##Internal function only #no examples # #
Full Bayesian cost-effectiveness models to handle missing data in the outcomes using Hurdle models
under a variatey of alternative parametric distributions for the effect and cost variables. Alternative
assumptions about the mechanisms of the structural values are implemented using a hurdle approach. The analysis is performed using the BUGS language,
which is implemented in the software JAGS using the function jags. The output is stored in an object of class 'missingHE'.
hurdle( data, model.eff, model.cost, model.se = se ~ 1, model.sc = sc ~ 1, se = 1, sc = 0, dist_e, dist_c, type, prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )hurdle( data, model.eff, model.cost, model.se = se ~ 1, model.sc = sc ~ 1, se = 1, sc = 0, dist_e, dist_c, type, prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )
data |
A data frame in which to find the variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.se |
A formula expression in conventional |
model.sc |
A formula expression in conventional |
se |
Structural value to be found in the effect variables defined in |
sc |
Structural value to be found in the cost variables defined in |
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
type |
Type of structural value mechanism assumed. Choices are Structural Completely At Random (SCAR), and Structural At Random (SAR). |
prob |
A numeric vector of probabilities within the range (0, 1), representing the upper and lower CI sample quantiles to be calculated and returned for the imputed values. |
n.chains |
Number of chains. |
n.iter |
Number of iterations. |
n.burnin |
Number of warmup iterations. |
inits |
A list with elements equal to the number of chains selected; each element of the list is itself a list of starting values for the
|
n.thin |
Thinning interval. |
save_model |
Logical. If |
prior |
A list containing the hyperprior values provided by the user. Each element of this list must be a vector
containing the user-provided prior distribution and parameter values and must be named with the name of the corresponding parameter. For example, the hyperprior
values for the standard deviation parameter for the effects can be provided using the list |
center |
Logical. If |
... |
Additional arguments that can be provided by the user. Examples are the additional arguments that can be provided to the function |
Depending on the distributions specified for the outcome variables in the arguments dist_e and
dist_c and the type of structural value mechanism specified in the argument type, different hurdle models
are built and run in the background by the function hurdle. These are mixture models defined by two components: the first one
is a mass distribution at the spike, while the second is a parametric model applied to the natural range of the relevant variable.
Usually, a logistic regression is used to estimate the probability of incurring a "structural" value (e.g. 0 for the costs, or 1 for the
effects); this is then used to weigh the mean of the "non-structural" values estimated in the second component.
A simple example can be used to show how hurdle models are specified.
Consider a data set comprising a response variable and a set of centered covariates , for .Specifically, for each subject in the trial
we define an indicator variable taking value 1 if the -th individual is associated with a structural value and 0 otherwise.
This is modelled as:
where
is the individual probability of a structural value in .
represents the impact on the probability of a structural value in of the covariate .
When , the model assumes a 'SCAR' mechanism, while when the mechanism is 'SAR'.
For the parameters indexing the structural value model, the default prior distributions assumed are:
When user-defined hyperprior values are supplied via the argument prior in the function hurdle, the elements of this list (see Arguments)
must be vectors containing the user-provided distribution name and hyperprior values and must take specific names according to the parameters they are associated with.
Specifically, the names accepted by missingHE are the following:
auxiliary parameters : "sigma.prior.e"(effects) and/or "sigma.prior.c"(costs)
covariate parameters : "alpha.prior"(effects) and/or "beta.prior"(costs)
covariate parameters in the model of the structural values (if covariate data provided): "gamma.prior.e"(effects) and/or "gamma.prior.c"(costs)
For simplicity, here we assumed that the set of covariates used in the models for the effects/costs and in the
model of the structural effect/cost values is the same. However, it is possible to specify different sets of covariates for each model
using the arguments in the function hurdle (see Arguments).
For each model, random effects can also be specified for each parameter by adding the term + (x | z) to each model formula, where x is the fixed regression coefficient for which also the random effects are desired and z is the clustering variable across which the random effects are specified (must be the name of a factor variable in the dataset). Multiple random effects can be specified using the notation + (x1 + x2 | site) for each covariate that was included in the fixed effects formula.
An object of the class 'missingHE' containing the following elements
A list containing the original data set provided in data (see Arguments). Additional information is also included about, among others,
the number of observed and missing individuals, the total number of individuals by treatment arm and the indicator vectors for the structural values
A list containing the output of a JAGS model generated from the functions jags, and
the posterior samples for the main parameters of the model
A list containing the output of the economic evaluation performed using the function bcea
A character variable that indicate which type of structural value mechanism used to run the model, either SCAR or SAR (see details)
A character variable that indicates which type of analysis was conducted, either using a wide or long dataset
Andrea Gabrio
Ntzoufras I. (2009). Bayesian Modelling Using WinBUGS, John Wiley and Sons.
Daniels, MJ. Hogan, JW. (2008). Missing Data in Longitudinal Studies: strategies for Bayesian modelling and sensitivity analysis, CRC/Chapman Hall.
Baio, G.(2012). Bayesian Methods in Health Economics. CRC/Chapman Hall, London.
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
Plummer, M. JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. (2003).
# Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the hurdle function assuming a SCAR mechanism # Use only 100 iterations to run a quick check model.hurdle <- hurdle(data = MenSS.subset, model.eff = e ~ trt, model.cost = c ~ trt, model.se = se ~ 1, model.sc = sc ~ 1, se = 1, sc = 0, dist_e = "norm", dist_c = "norm", type = "SCAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.hurdle) # # Use dic information criterion to assess model fit pic.dic <- pic(model.hurdle, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.hurdle) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.hurdle, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posteiror means and credible intervals) p1 <- plot(model.hurdle, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.hurdle) # Further examples which take longer to run model.hurdle <- hurdle(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, model.se = se ~ age, model.sc = sc ~ age, se = 1, sc = 0, dist_e = "norm", dist_c = "norm", type = "SAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.hurdle) # Use looic to assess model fit pic.looic <- pic(model.hurdle, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.hurdle, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.hurdle, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.hurdle) # ## Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the hurdle function assuming a SCAR mechanism # Use only 100 iterations to run a quick check model.hurdle <- hurdle(data = MenSS.subset, model.eff = e ~ trt, model.cost = c ~ trt, model.se = se ~ 1, model.sc = sc ~ 1, se = 1, sc = 0, dist_e = "norm", dist_c = "norm", type = "SCAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.hurdle) # # Use dic information criterion to assess model fit pic.dic <- pic(model.hurdle, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.hurdle) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.hurdle, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posteiror means and credible intervals) p1 <- plot(model.hurdle, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.hurdle) # Further examples which take longer to run model.hurdle <- hurdle(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, model.se = se ~ age, model.sc = sc ~ age, se = 1, sc = 0, dist_e = "norm", dist_c = "norm", type = "SAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.hurdle) # Use looic to assess model fit pic.looic <- pic(model.hurdle, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.hurdle, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.hurdle, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.hurdle) # #
An internal function to detect the random effects component from an object of class formula
isAnyArgBar(term)isAnyArgBar(term)
term |
formula to be processed |
#Internal function only #no examples # ##Internal function only #no examples # #
An internal function to detect the random effects component from an object of class formula
isBar(term)isBar(term)
term |
formula to be processed |
#Internal function only #no examples # ##Internal function only #no examples # #
This function hides missing data distribution from summary results of BUGS models
jagsresults( x, params, regex = FALSE, invert = FALSE, probs = c(0.025, 0.25, 0.5, 0.75, 0.975), signif, ... )jagsresults( x, params, regex = FALSE, invert = FALSE, probs = c(0.025, 0.25, 0.5, 0.75, 0.975), signif, ... )
x |
The |
params |
Character vector or a regular expression pattern. The
parameters for which results will be printed (unless |
regex |
If |
invert |
Logical. If |
probs |
A numeric vector of probabilities within range [0, 1], representing the sample quantiles to be calculated and returned. |
signif |
If supplied, all columns other than |
... |
Additional arguments accepted by |
## Not run: ## Data N <- 100 temp <- runif(N) rain <- runif(N) wind <- runif(N) a <- 0.13 beta.temp <- 1.3 beta.rain <- 0.86 beta.wind <- -0.44 sd <- 0.16 y <- rnorm(N, a + beta.temp*temp + beta.rain*rain + beta.wind*wind, sd) dat <- list(N=N, temp=temp, rain=rain, wind=wind, y=y) ### bugs example library(R2jags) ## Model M <- function() { for (i in 1:N) { y[i] ~ dnorm(y.hat[i], sd^-2) y.hat[i] <- a + beta.temp*temp[i] + beta.rain*rain[i] + beta.wind*wind[i] resid[i] <- y[i] - y.hat[i] } sd ~ dunif(0, 100) a ~ dnorm(0, 0.0001) beta.temp ~ dnorm(0, 0.0001) beta.rain ~ dnorm(0, 0.0001) beta.wind ~ dnorm(0, 0.0001) } ## Fit model jagsfit <- jags(dat, inits=NULL, parameters.to.save=c('a', 'beta.temp', 'beta.rain', 'beta.wind', 'sd', 'resid'), model.file=M, n.iter=10000) ## Output # model summary jagsfit # Results for beta.rain only jagsresults(x=jagsfit, param='beta.rain') # Results for 'a' and 'sd' only jagsresults(x=jagsfit, param=c('a', 'sd')) jagsresults(x=jagsfit, param=c('a', 'sd'), probs=c(0.01, 0.025, 0.1, 0.25, 0.5, 0.75, 0.9, 0.975)) # Results for all parameters including the string 'beta' jagsresults(x=jagsfit, param='beta', regex=TRUE) # Results for all parameters not including the string 'beta' jagsresults(x=jagsfit, param='beta', regex=TRUE, invert=TRUE) # Note that the above is NOT equivalent to the following, which returns all # parameters that are not EXACTLY equal to 'beta'. jagsresults(x=jagsfit, param='beta', invert=TRUE) # Results for all parameters beginning with 'b' or including 'sd'. jagsresults(x=jagsfit, param='^b|sd', regex=TRUE) # Results for all parameters not beginning with 'beta'. # This is equivalent to using param='^beta' with invert=TRUE and regex=TRUE jagsresults(x=jagsfit, param='^(?!beta)', regex=TRUE, perl=TRUE) ## End(Not run) # ### Not run: ## Data N <- 100 temp <- runif(N) rain <- runif(N) wind <- runif(N) a <- 0.13 beta.temp <- 1.3 beta.rain <- 0.86 beta.wind <- -0.44 sd <- 0.16 y <- rnorm(N, a + beta.temp*temp + beta.rain*rain + beta.wind*wind, sd) dat <- list(N=N, temp=temp, rain=rain, wind=wind, y=y) ### bugs example library(R2jags) ## Model M <- function() { for (i in 1:N) { y[i] ~ dnorm(y.hat[i], sd^-2) y.hat[i] <- a + beta.temp*temp[i] + beta.rain*rain[i] + beta.wind*wind[i] resid[i] <- y[i] - y.hat[i] } sd ~ dunif(0, 100) a ~ dnorm(0, 0.0001) beta.temp ~ dnorm(0, 0.0001) beta.rain ~ dnorm(0, 0.0001) beta.wind ~ dnorm(0, 0.0001) } ## Fit model jagsfit <- jags(dat, inits=NULL, parameters.to.save=c('a', 'beta.temp', 'beta.rain', 'beta.wind', 'sd', 'resid'), model.file=M, n.iter=10000) ## Output # model summary jagsfit # Results for beta.rain only jagsresults(x=jagsfit, param='beta.rain') # Results for 'a' and 'sd' only jagsresults(x=jagsfit, param=c('a', 'sd')) jagsresults(x=jagsfit, param=c('a', 'sd'), probs=c(0.01, 0.025, 0.1, 0.25, 0.5, 0.75, 0.9, 0.975)) # Results for all parameters including the string 'beta' jagsresults(x=jagsfit, param='beta', regex=TRUE) # Results for all parameters not including the string 'beta' jagsresults(x=jagsfit, param='beta', regex=TRUE, invert=TRUE) # Note that the above is NOT equivalent to the following, which returns all # parameters that are not EXACTLY equal to 'beta'. jagsresults(x=jagsfit, param='beta', invert=TRUE) # Results for all parameters beginning with 'b' or including 'sd'. jagsresults(x=jagsfit, param='^b|sd', regex=TRUE) # Results for all parameters not beginning with 'beta'. # This is equivalent to using param='^beta' with invert=TRUE and regex=TRUE jagsresults(x=jagsfit, param='^(?!beta)', regex=TRUE, perl=TRUE) ## End(Not run) # #
Full Bayesian cost-effectiveness models to handle missing data in longitudinal outcomes under different missing data
mechanism assumptions, using alternative parametric distributions for the effect and cost variables. The analysis is performed using the BUGS language,
which is implemented in the software JAGS using the function jags The output is stored in an object of class 'missingHE'.
lmdm( data, model.eff, model.cost, model.me = me ~ 1, model.mc = mc ~ 1, dist_e, dist_c, type, time_dep = "AR1", prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )lmdm( data, model.eff, model.cost, model.me = me ~ 1, model.mc = mc ~ 1, dist_e, dist_c, type, time_dep = "AR1", prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )
data |
A data frame in which to find the longitudinal variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.me |
A formula expression in conventional |
model.mc |
A formula expression in conventional |
dist_e |
Distribution assumed for the effects. Current available chocies are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available chocies are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
time_dep |
Type of dependence structure assumed between effectiveness and cost outcomes. Current choices include: autoregressive structure of order one ('AR1') - default, bivariate at each time ('biv') and independence ('none'). |
prob |
A numeric vector of probabilities within the range (0, 1), representing the upper and lower CI sample quantiles to be calculated and returned for the imputed values. |
n.chains |
Number of chains. |
n.iter |
Number of iterations. |
n.burnin |
Number of warmup iterations. |
inits |
A list with elements equal to the number of chains selected; each element of the list is itself a list of starting values for the
|
n.thin |
Thinning interval. |
save_model |
Logical. If |
prior |
A list containing the hyperprior values provided by the user. Each element of this list must be a vector
containing the user-provided prior distribution and parameter values and must be named with the name of the corresponding parameter. For example, the hyperprior
values for the standard deviation parameter for the effects can be provided using the list |
center |
Logical. If |
... |
Additional arguments that can be provided by the user. Examples are the additional arguments that can be provided to the function |
Depending on the distributions specified for the outcome variables in the arguments dist_e and
dist_c and the type of missingness mechanism specified in the argument type, different models
are built and run in the background by the function lmdm. These models fit multinomial logistic regressions to estimate
the probability of a given missing data pattern k (1 = completers, 2 = intermittent, 3 = dropout) in one or both longitudinal outcomes. A simple example can be used
to show how longitudinal missing data models are specified. Consider a longitudinal data set comprising a response variable measured at S occasions
and a set of centered covariate , for . For each subject in the trial and time we define
an indicator variable taking value k = 1 if the -th individual is associated with no missing value (completer), a value k = 2
for intermittent missingness over the study period, and a value k = 3 for dropout.
This is modelled as:
where
is the individual probability of a missing value in for pattern at a given time.
represents the impact on the missing data probability in of the covariate for pattern at a given time.
represents the impact on the missing data probability in for pattern of missingness itself at a given time.
When the model assumes a 'MAR' mechanism, while when the mechanism is 'MNAR'. For the parameters indexing the missingness model,
the default prior distributions assumed are:
When user-defined hyperprior values are supplied via the argument prior in the function lmdm, the elements of this list (see Arguments)
must be vectors containing the user-provided distribution name and hyperprior values and must take specific names according to the parameters they are associated with.
Specifically, the names for the parameters indexing the model which are accepted by missingHE are the following:
auxiliary parameters : "sigma.prior.e"(effects) and/or "sigma.prior.c"(costs)
covariate parameters and : "alpha.prior"(effects) and/or "beta.prior"(costs)
covariate parameters in the missingness model (if covariate data provided): "gamma.prior.e"(effects) and/or "gamma.prior.c"(costs)
mnar parameter : "delta.prior.e"(effects) and/or "delta.prior.c"(costs)
For simplicity, here we have assumed that the set of covariates used in the models for the effects/costs and in the
model of the missing effect/cost values is the same. However, it is possible to specify different sets of covariates for each model
using the arguments in the function lmdm (see Arguments).
For each model, random effects can also be specified for each parameter by adding the term + (x | z) to each model formula, where x is the fixed regression coefficient for which also the random effects are desired and z is the clustering variable across which the random effects are specified (must be the name of a factor variable in the dataset).
An object of the class 'missingHE' containing the following elements
A list containing the original data set provided in data (see Arguments). Additional information is also included about, among others,
the number of observed and missing individuals, the total number of individuals by treatment arm and the indicator vectors for the missing values
A list containing the output of a JAGS model generated from the functions jags, and
the posterior samples for the main parameters of the model
A list containing the output of the economic evaluation performed using the function bcea
A character variable that indicate which type of missing value mechanism used to run the model, either MAR or MNAR (see details)
A character variable that indicates which type of analysis was conducted, either using a wide or long dataset
A character variable that indicate which type of time dependence assumption was made, either none or AR1
Andrea Gabrio
Mason, AJ. Gomes, M. Carpenter, J. Grieve, R. (2021). Flexible Bayesian longitudinal models for cost‐effectiveness analyses with informative missing data. Health economics, 30(12), 3138-3158.
Daniels, MJ. Hogan, JW. Missing Data in Longitudinal Studies: strategies for Bayesian modelling and sensitivity analysis, CRC/Chapman Hall.
Baio, G.(2012). Bayesian Methods in Health Economics. CRC/Chapman Hall, London.
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
Plummer, M. JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. (2003).
# Quick example to run using subset of PBS dataset # Load longitudinal dataset PBS.long <- PBS # Run the model using the long_miss function assuming a MAR mechanism # Use only 100 iterations to run a quick check model.long <- lmdm(data = PBS.long, model.eff = e ~ trt, model.cost = c ~ trt, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100, time_dep = "none") # Extract regression coefficient estimates coef(model.long) # # Summarise the CEA information from the model summary(model.long) # Further examples which take longer to run model.long <- lmdm(data = PBS.long, model.eff = e ~ trt, model.cost = c ~ trt + age, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500, time_dep = "none") # Use looic to assess model fit pic.looic <- pic(model.long, criterion = "looic") pic.looic # Show density plots for all parameters diag.den <- diagnostic(model.long, type = "denplot", param = "alpha") # Plots of imputations for all effect data p1 <- plot(model.long, class = "scatter", outcome = "effects", time.plot = "all") # Summarise the CEA results summary(model.long) # ## Quick example to run using subset of PBS dataset # Load longitudinal dataset PBS.long <- PBS # Run the model using the long_miss function assuming a MAR mechanism # Use only 100 iterations to run a quick check model.long <- lmdm(data = PBS.long, model.eff = e ~ trt, model.cost = c ~ trt, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100, time_dep = "none") # Extract regression coefficient estimates coef(model.long) # # Summarise the CEA information from the model summary(model.long) # Further examples which take longer to run model.long <- lmdm(data = PBS.long, model.eff = e ~ trt, model.cost = c ~ trt + age, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500, time_dep = "none") # Use looic to assess model fit pic.looic <- pic(model.long, criterion = "looic") pic.looic # Show density plots for all parameters diag.den <- diagnostic(model.long, type = "denplot", param = "alpha") # Plots of imputations for all effect data p1 <- plot(model.long, class = "scatter", outcome = "effects", time.plot = "all") # Summarise the CEA results summary(model.long) # #
Data from a pilot RCT trial (The MenSS trial) on youn men at risk of Sexually Trasmitted Infections (STIs). A total of 159 individuals were enrolled in trial: 75 in the control (t=1) and 84 in the active intervention (t=2). Clinical and health economic outcome data were collected via self-reported questionnaires at four time points throughout the study: baseline, 3 months, 6 months and 12 months follow-up. Health economic data include utility scores related to quality of life and costs, from which QALYs and total costs were then computed using the area under the curve method and by summing up the cost components at each time point. Clinical data include the total number of instances of unprotected sex and whether the individual was associated with an STI diagnosis or not. Baseline data are available for the utilities (no baseline costs collected), instances of unprotected sex, sti diagnosis, age, ethnicity and employment variables.
Data from a pilot RCT trial (The MenSS trial) on youn men at risk of Sexually Trasmitted Infections (STIs). A total of 159 individuals were enrolled in trial: 75 in the control (t=1) and 84 in the active intervention (t=2). Clinical and health economic outcome data were collected via self-reported questionnaires at four time points throughout the study: baseline, 3 months, 6 months and 12 months follow-up. Health economic data include utility scores related to quality of life and costs, from which QALYs and total costs were then computed using the area under the curve method and by summing up the cost components at each time point. Clinical data include the total number of instances of unprotected sex and whether the individual was associated with an STI diagnosis or not. Baseline data are available for the utilities (no baseline costs collected), instances of unprotected sex, sti diagnosis, age, ethnicity and employment variables.
data(MenSS) data(MenSS)data(MenSS) data(MenSS)
A data frame with 159 rows and 12 variables
A data frame with 159 rows and 12 variables
id number
Quality Adjusted Life Years (QALYs)
Total costs in pounds
baseline utilities
Age in years
binary: white (1) and other (0)
binary: working (1) and other (0)
Treatment arm indicator for the control (t=1) and the active intervention (t=2)
baseline number of instances of unprotected sex
number of instances of unprotected sex at 12 months follow-up
binary : baseline sti diagnosis (1) and no baseline sti diagnosis (0)
binary : sti diagnosis (1) and no sti diagnosis (0) at 12 months follow-up
site number
id number
Quality Adjusted Life Years (QALYs)
Total costs in pounds
baseline utilities
Age in years
binary: white (1) and other (0)
binary: working (1) and other (0)
Treatment arm indicator for the control (t=1) and the active intervention (t=2)
baseline number of instances of unprotected sex
number of instances of unprotected sex at 12 months follow-up
binary : baseline sti diagnosis (1) and no baseline sti diagnosis (0)
binary : sti diagnosis (1) and no sti diagnosis (0) at 12 months follow-up
site number
Bailey et al. (2016) Health Technology Assessment 20 (PubMed)
Bailey et al. (2016) Health Technology Assessment 20 (PubMed)
MenSS <- data(MenSS) summary(MenSS) str(MenSS) MenSS <- data(MenSS) summary(MenSS) str(MenSS)MenSS <- data(MenSS) summary(MenSS) str(MenSS) MenSS <- data(MenSS) summary(MenSS) str(MenSS)
An internal function to separate the fixed and random effects components from an object of class formula
nobars_(term)nobars_(term)
term |
formula to be processed |
#Internal function only #no examples # ##Internal function only #no examples # #
Full Bayesian cost-effectiveness models to handle missing data in the outcomes under different missing data
mechanism assumptions, using alternative parametric distributions for the effect and cost variables and
using a pattern mixture model approach to identify the model. The analysis is performed using the BUGS language,
which is implemented in the software JAGS using the function jags The output is stored in an object of class 'missingHE'.
pattern( data, model.eff, model.cost, dist_e, dist_c, type, restriction = "CC", prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )pattern( data, model.eff, model.cost, dist_e, dist_c, type, restriction = "CC", prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )
data |
A data frame in which to find the variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
restriction |
type of identifying restriction to be imposed to identify the distributions of the missing data in each pattern. Available choices are: complete case restrcition ('CC') - default - or available case restriction ('AC'). |
prob |
A numeric vector of probabilities within the range (0, 1), representing the upper and lower CI sample quantiles to be calculated and returned for the imputed values. |
n.chains |
Number of chains. |
n.iter |
Number of iterations. |
n.burnin |
Number of warmup iterations. |
inits |
A list with elements equal to the number of chains selected; each element of the list is itself a list of starting values for the
|
n.thin |
Thinning interval. |
save_model |
Logical. If |
prior |
A list containing the hyperprior values provided by the user. Each element of this list must be a vector
containing the user-provided prior distribution and parameter values and must be named with the name of the corresponding parameter. For example, the hyperprior
values for the standard deviation parameter for the effects can be provided using the list |
center |
Logical. If |
... |
Additional arguments that can be provided by the user. Examples are the additional arguments that can be provided to the function |
Depending on the distributions specified for the outcome variables in the arguments dist_e and
dist_c and the type of missingness mechanism specified in the argument type, different pattern mixture models
are built and run in the background by the function pattern. The model for the outcomes is fitted in each missingness pattern
and the parameters indexing the missing data distributions are identified using: the corresponding parameters identified from the observed data
in other patterns (under 'MAR'); or a combination of the parameters identified by the observed data and some sensitivity parameters (under 'MNAR').
A simple example can be used to show how pattern mixture models are specified.
Consider a data set comprising a response variable and a set of centered covariates . We denote with the patterns' indicator variable for each
subject in the trial such that: indicates the completers (both e and c observed), and indicate that
only the costs or effects are observed, respectively, while indicates that neither of the two outcomes is observed. is assigned a multinomial distribution,
which probabilities are modelled using a Dirichlet prior. Next, the outcomes model is fitted in each pattern and parameters that cannot be identified in each pattern (d = 2, 3, 4),
e.g. and mu_c[d], are identified using some restrictions based on the parameters estimated from other patterns. Two choices are currently available: the complete cases ('CC') or available cases ('AC').
For example, using the 'CC' restriction, the parameters indexing the distributions of the missing data are identified as:
where
is the effects mean for the completers.
is the costs mean for the completers.
is the sensitivity parameters associated with the marginal effects mean.
is the sensitivity parameters associated with the marginal costs mean.
If the 'AC' restriction is chosen, only the parameters estimated from the observed data in pattern 2 (costs) and pattern 3 (effects) are used to identify those in the other patterns.
When and the model assumes a 'MAR' mechanism. When and/or 'MNAR' departures for the
effects and/or costs are explored with priors on sensitivity parameters that must be provided by the user (see Arguments).
When user-defined hyperprior values are supplied via the argument prior in the function pattern, the elements of this list (see Arguments)
must be vectors containing the user-provided distribution name and hyperprior values and must take specific names according to the parameters they are associated with.
Specifically, the names for the parameters indexing the model which are accepted by missingHE are the following:
auxiliary parameters : "sigma.prior.e"(effects) and/or "sigma.prior.c"(costs)
covariate parameters and : "alpha.prior"(effects) and/or "beta.prior"(costs)
covariate parameters in the missingness model (if covariate data provided): "gamma.prior.e"(effects) and/or "gamma.prior.c"(costs)
sensitivity parameters : "delta.prior.e"(effects) and/or "delta.prior.c"(costs)
missingness patterns' probabilities : "patterns.prior"
For each outcome model, random effects can also be specified for each parameter by adding the term + (x | z) to each model formula, where x is the fixed regression coefficient for which also the random effects are desired and z is the clustering variable across which the random effects are specified (must be the name of a factor variable in the dataset). Multiple random effects can be specified using the notation + (x1 + x2 | site) for each covariate that was included in the fixed effects formula.
An object of the class 'missingHE' containing the following elements
A list containing the original data set provided in data (see Arguments). Additional information is also included about, among others,
the number of observed and missing individuals, the total number of individuals by treatment arm and the indicator vectors for the missing values
A list containing the output of a JAGS model generated from the functions jags, and
the posterior samples for the main parameters of the model
A list containing the output of the economic evaluation performed using the function bcea
A character variable that indicate which type of missing value mechanism used to run the model, either MAR or MNAR (see details)
A character variable that indicates which type of analysis was conducted, either using a wide or long dataset
Andrea Gabrio
Daniels, MJ. Hogan, JW. Missing Data in Longitudinal Studies: strategies for Bayesian modelling and sensitivity analysis, CRC/Chapman Hall.
Baio, G.(2012). Bayesian Methods in Health Economics. CRC/Chapman Hall, London.
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
Plummer, M. JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. (2003).
# Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the pattern function assuming a MAR mechanism # Use only 100 iterations to run a quick check model.pattern <- pattern(data = MenSS.subset,model.eff = e ~ trt, model.cost = c ~ trt, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.pattern) # # Use dic information criterion to assess model fit pic.dic <- pic(model.pattern, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.pattern) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.pattern, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posteiror means and credible intervals) p1 <- plot(model.pattern, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.pattern) # Further examples which take longer to run model.pattern <- pattern(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.pattern) # Use looic to assess model fit pic.looic <- pic(model.pattern, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.pattern, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.pattern, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.pattern) # ## Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the pattern function assuming a MAR mechanism # Use only 100 iterations to run a quick check model.pattern <- pattern(data = MenSS.subset,model.eff = e ~ trt, model.cost = c ~ trt, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.pattern) # # Use dic information criterion to assess model fit pic.dic <- pic(model.pattern, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.pattern) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.pattern, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posteiror means and credible intervals) p1 <- plot(model.pattern, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.pattern) # Further examples which take longer to run model.pattern <- pattern(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.pattern) # Use looic to assess model fit pic.looic <- pic(model.pattern, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.pattern, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.pattern, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.pattern) # #
Longitudinal data from a cluster RCT trial (The PBS trial) on people suffering from intellectual disability and challenging behaviour. A total of 244 individuals across 23 sites were enrolled in the trial: 136 in the control (t=1) and 108 in the active intervention (t=2). Health economic outcome data were collected via self-reported questionnaires at three time points throughout the study: baseline (time=1), 6 months (time=2) and 12 months (time=3) follow-up, and included utility scores related to quality of life and costs. Baseline data are available for age, gender, ethnicity, living status, type of carer, marital status, and disability level variables.
data(PBS)data(PBS)
A data frame with 732 rows and 16 variables
id number
time indicator
HRQoL utilities
costs (in pounds)
Treatment arm indicator for the control (t=1) and the active intervention (t=2)
age in years
binary: male (1) and female (0)
binary: white (1) and other (0)
binary: paid carer (1) and family carer (0)
binary: single (1) and married (0)
categorical: alone (1), with partner (2) and with parents (3)
categorical: mild (1), moderate (2) and severe (3)
site number
Hassiotis et al. (2014) BMC Psychiatry 14 (PubMed)
PBS <- data(PBS) summary(PBS) str(PBS)PBS <- data(PBS) summary(PBS) str(PBS)
JAGS using the function selection, pattern, hurdle or lmdm
Efficient approximate leave-one-out cross validation (LOO), deviance information criterion (DIC) and widely applicable information criterion (WAIC) for Bayesian models, calculated on the observed data.
pic(x, criterion = "dic", cases = "cc", ...)pic(x, criterion = "dic", cases = "cc", ...)
x |
A |
criterion |
type of information criteria to be produced. Available choices are |
cases |
group of cases for which information criteria should be computed for: either |
... |
Additional parameters that can be provided to manage the output of |
The Deviance Information Criterion (DIC), Leave-One-Out Information Criterion (LOOIC) and the Widely Applicable Information Criterion (WAIC) are methods for estimating out-of-sample predictive accuracy from a Bayesian model using the log-likelihood evaluated at the posterior simulations of the parameters. DIC is computationally simple to calculate but it is known to have some problems, arising in part from it not being fully Bayesian in that it is based on a point estimate. LOOIC can be computationally expensive but can be easily approximated using importance weights that are smoothed by fitting a generalised Pareto distribution to the upper tail of the distribution of the importance weights. WAIC is fully Bayesian and closely approximates Bayesian cross-validation. Unlike DIC, WAIC is invariant to parameterisation and also works for singular models. In finite cases, WAIC and LOOIC give similar estimates, but for influential observations WAIC underestimates the effect of leaving out one observation.
A named list containing different predictive information criteria results and quantities according to the value of criterion. In all cases, the measures are
computed on the observed data for the specific modules of the model selected in module.
Posterior mean deviance (only if criterion is 'dic').
Effective number of parameters calculated with the formula used by JAGS (only if criterion is 'dic')
.
Deviance Information Criterion calculated with the formula used by JAGS (only if criterion is 'dic')
.
Deviance evaluated at the posterior mean of the parameters and calculated with the formula used by JAGS (only if criterion is 'dic')
Expected log pointwise predictive density and standard error calculated on the observed data for the model nodes indicated in module
(only if criterion is 'waic' or 'looic').
Effective number of parameters and standard error calculated on the cases indicated in cases.
(only if criterion is 'waic' or 'looic').
The leave-one-out information criterion and standard error calculated on the cases indicated in cases.
(only if criterion is 'looic').
The widely applicable information criterion and standard error calculated on the cases indicated in cases.
(only if criterion is 'waic').
A matrix containing the pointwise contributions of each of the above measures calculated on the cases indicated in cases.
(only if criterion is 'waic' or 'looic').
A named list containing additional diagnostic measures (only if criterion is 'looic').
See loo for details about interpreting the list elements.
A named list containing the matrix of (smoothed) log weights (only if criterion is 'looic' with the optional argument 'save_psis' is set to TRUE).
See loo for details about interpreting the list elements.
'
Andrea Gabrio
Plummer, M. JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. (2003).
Vehtari, A. Gelman, A. Gabry, J. (2016a) Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. Advance online publication.
Vehtari, A. Gelman, A. Gabry, J. (2016b) Pareto smoothed importance sampling. ArXiv preprint.
Gelman, A. Hwang, J. Vehtari, A. (2014) Understanding predictive information criteria for Bayesian models. Statistics and Computing 24, 997-1016.
Watanable, S. (2010). Asymptotic equivalence of Bayes cross validation and widely application information criterion in singular learning theory. Journal of Machine Learning Research 11, 3571-3594.
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # #
missingHE
Produces a plot of the observed and imputed values (with credible intervals) for the effect and cost outcomes from a
Bayesian cost-effectiveness analysis model with two treatment arms, implemented using the function selection, pattern,
hurdle or lmdm.
The graphical layout is obtained from the functions contained in the package ggplot2 and ggthemes.
## S3 method for class 'missingHE' plot( x, prob = c(0.025, 0.975), class = "scatter", outcome = "both", trt = "all", time_plot = NULL, theme = NULL, only.plot = TRUE, ... )## S3 method for class 'missingHE' plot( x, prob = c(0.025, 0.975), class = "scatter", outcome = "both", trt = "all", time_plot = NULL, theme = NULL, only.plot = TRUE, ... )
x |
A |
prob |
A numeric vector of probabilities representing the upper and lower CI sample quantiles to be calculated and returned for the imputed values. |
class |
Type of the plot comparing the observed and imputed outcome data. Available choices are 'scatter' (default), 'histogram' and 'boxplot' for a scatter, histogram or a boxplot of the observed and average imputed outcome data, respectively. |
outcome |
The outcome variables that should be displayed. Options are: 'both' (default) for both effects and costs; 'effects' or 'costs' for the effects or costs separately. |
trt |
treatment group for which plots should be displayed. Choices include: 'all' (default) for all groups; 'none' for results across all groups; any character or numeric value denoting the treatment group name or index associated with the treatment variable in the original data set. |
time_plot |
Time point for which the graphs should be displayed. |
theme |
Type of ggplot theme among some pre-defined themes, mostly taken from the package ggthemes. For a full list of available themes see details. |
only.plot |
Logical. If |
... |
Additional parameters that can be provided to manage the output of |
The function produces a plot of the observed and imputed effect and cost data in a two-arm based
cost-effectiveness model implemented using the function selection, pattern, hurdle or or lmdm.
The purpose of this graph is to visually compare the outcome values for the fully-observed individuals with those imputed by the model for the missing individuals.
For scatter plots, average imputed values are also associated with credible intervals specified in the argument prob.
The argument theme allows to customise the graphical aspect of the plots generated by plot.missingHE and
allows to choose among a set of possible pre-defined themes taken form the package ggtheme. For a complete list of the available character names
for each theme and scheme set, see ggthemes and bayesplot.
A ggplot object containing the plots specified in the argument class.
Andrea Gabrio
Daniels, MJ. Hogan, JW. (2008) Missing Data in Longitudinal Studies: strategies for Bayesian modelling and sensitivity analysis, CRC/Chapman Hall.
Molenberghs, G. Fitzmaurice, G. Kenward, MG. Tsiatis, A. Verbeke, G. (2015) Handbook of Missing Data Methodology, CRC/Chapman Hall.
selection pattern hurdle lmdm diagnostic
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # #
JAGS using the function selection, pattern, hurdle or lmdm
The focus is restricted to full Bayesian models in cost-effectiveness analyses based on the function selection, pattern,
hurdle or lmdm with the fit to the observed data being assessed through graphical checks based on the posterior replications generated from the model.
Examples include the comparison of histograms, density plots, intervals, test statistics, evaluated using both the observed and replicated data.
Different types of posterior predictive checks are implemented to assess model fit using functions contained in the package bayesplot.
Graphics and plots are managed using functions contained in the package ggplot2 and ggthemes.
ppc( x, type = "histogram", outcome = "both", ndisplay = 15, trt = "all", theme = NULL, scheme_set = NULL, ... )ppc( x, type = "histogram", outcome = "both", ndisplay = 15, trt = "all", theme = NULL, scheme_set = NULL, ... )
x |
An object of class "missingHE" containing the posterior results of a full Bayesian model implemented using the function |
type |
Type of posterior predictive check among some pre-defined types, mostly taken from the package bayesplot. For a full list of available options see details. |
outcome |
The outcome variables that should be displayed. Options are: 'both' (default) for both effects and costs; 'effects' or 'costs' for the effects or costs separately. |
ndisplay |
Number of posterior replications to be used to generate the plots. |
trt |
treatment group for which plots should be displayed. Choices include: 'all' (default) for all groups; 'none' for results across all groups; any character or numeric value denoting the treatment group name or index associated with the treatment variable in the original data set. |
theme |
Type of ggplot theme among some pre-defined themes, mostly taken from the package ggthemes. For a full list of available themes see details. |
scheme_set |
Type of scheme sets among some pre-defined schemes, mostly taken from the package bayesplot. For a full list of available themes see details. |
... |
Additional parameters that can be provided to manage the output of |
The function produces different types of graphical posterior predictive checks using the estimates from a Bayesian cost-effectiveness model implemented
with the function selection, pattern, hurdle or lmdm. The purpose of these checks is to visually compare the distribution (or some relevant quantity)
of the observed data with respect to that from the replicated data for both effectiveness and cost outcomes in each treatment arm. Since predictive checks are meaningful
only with respect to the observed data, only the observed outcome values are used to assess the fit of the model.
The arguments theme and scheme_set allow to customise the graphical aspect of the plots generated by ppc and allow to choose among a set of possible
pre-defined themes and scheme sets taken form the package ggtheme and bayesplot. For a complete list of the available character names for each theme and scheme set, see ggthemes and bayesplot.
A ggplot object containing the plots specified in the argument type.
Andrea Gabrio
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
selection pattern hurdle lmdm diagnostic
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} #
missingHE
Prints the summary table for the model fitted, with the estimate of the parameters and/or missing values.
## S3 method for class 'missingHE' print(x, display = "fixed", digits = 3, ...)## S3 method for class 'missingHE' print(x, display = "fixed", digits = 3, ...)
x |
A |
display |
Set of parameters for which posterior summaries are displayed. Choices are: fixed effects ('fixed'), random effects ('random'), individual log likelihood values ('loglik'), individual conditional parameter values ('conditional') and individual imputed values ('mis'). |
digits |
Integer indicating the number of decimal places to be used for rounding (default = 3). |
... |
additional arguments affecting the output produced. For example: |
Andrea Gabrio
# For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # ## For examples see the function \code{\link{selection}}, \code{\link{pattern}}, # \code{\link{hurdle}} or \code{\link{lmdm}} # #
This function modifies default hyper prior parameter values in the type of hurdle model selected according to the type of structural value mechanism and distributions for the outcomes assumed.
prior_hurdle(type, dist_e, dist_c, model_txt_info, model_string_jags)prior_hurdle(type, dist_e, dist_c, model_txt_info, model_string_jags)
type |
Type of structural value mechanism assumed. Choices are Structural Completely At Random (SCAR) and Structural At Random (SAR). For a complete list of all available hyper parameters and types of models see the manual. |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weibull'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('nbinom') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
model_string_jags |
text file of the model. |
#Internal function only #no examples # ##Internal function only #no examples # #
This function modifies default hyper prior parameter values in the type of longitudinal missing data model selected according to the type of missingness mechanism and distributions for the outcomes assumed.
prior_lmdm(type, dist_e, dist_c, model_txt_info, model_string_jags)prior_lmdm(type, dist_e, dist_c, model_txt_info, model_string_jags)
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). For a complete list of all available hyper parameters and types of models see the manual. |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
model_string_jags |
text file of the model. |
#Internal function only #no examples # ##Internal function only #no examples # #
This function modifies default hyper prior parameter values in the type of pattern mixture model selected according to the type of missingness mechanism and distributions for the outcomes assumed.
prior_pattern(type, dist_e, dist_c, model_txt_info, model_string_jags)prior_pattern(type, dist_e, dist_c, model_txt_info, model_string_jags)
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). For a complete list of all available hyper parameters and types of models see the manual. |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
model_string_jags |
text file of the model. |
#Internal function only #no examples # ##Internal function only #no examples # #
This function modifies default hyper prior parameter values in the type of selection model selected according to the type of missingness mechanism and distributions for the outcomes assumed.
prior_selection(type, dist_e, dist_c, model_txt_info, model_string_jags)prior_selection(type, dist_e, dist_c, model_txt_info, model_string_jags)
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). For a complete list of all available hyper parameters and types of models see the manual. |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
model_string_jags |
text file of the model. |
#Internal function only #no examples # ##Internal function only #no examples # #
This function fits a JAGS using the jags function and obtain posterior inferences.
run_hurdle(data_model, type, dist_e, dist_c, model_info)run_hurdle(data_model, type, dist_e, dist_c, model_info)
data_model |
list containing the data for the model to be passed to JAGS. |
type |
Type of structural value mechanism assumed. Choices are Structural Completely At Random (SCAR), Structural At Random (SAR), |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
model_info |
list containing model and MCMC information to be passed to JAGS. |
#Internal function only #No examples # ##Internal function only #No examples # #
This function fits a JAGS using the jags function and obtain posterior inferences.
run_lmdm(data_model, type, dist_e, dist_c, model_info)run_lmdm(data_model, type, dist_e, dist_c, model_info)
data_model |
list containing the data for the model to be passed to JAGS. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
model_info |
list containing model and MCMC information to be passed to JAGS. |
#Internal function only #No examples # ##Internal function only #No examples # #
This function fits a JAGS using the jags function and obtain posterior inferences.
run_pattern(data_model, type, dist_e, dist_c, model_info)run_pattern(data_model, type, dist_e, dist_c, model_info)
data_model |
list containing the data for the model to be passed to JAGS. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
model_info |
list containing model and MCMC information to be passed to JAGS. |
#Internal function only #No examples # ##Internal function only #No examples # #
This function fits a JAGS using the jags function and obtain posterior inferences.
run_selection(data_model, type, dist_e, dist_c, model_info)run_selection(data_model, type, dist_e, dist_c, model_info)
data_model |
list containing the data for the model to be passed to JAGS. |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR). |
dist_e |
distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
model_info |
list containing model and MCMC information to be passed to JAGS. |
#Internal function only #No examples # ##Internal function only #No examples # #
Full Bayesian cost-effectiveness models to handle missing data in the outcomes under different missing data
mechanism assumptions, using alternative parametric distributions for the effect and cost variables and
using a selection model approach to identify the model. The analysis is performed using the BUGS language,
which is implemented in the software JAGS using the function jags The output is stored in an object of class 'missingHE'.
selection( data, model.eff, model.cost, model.me = me ~ 1, model.mc = mc ~ 1, dist_e, dist_c, type, prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )selection( data, model.eff, model.cost, model.me = me ~ 1, model.mc = mc ~ 1, dist_e, dist_c, type, prob = c(0.025, 0.975), n.chains = 2, n.iter = 10000, n.burnin = floor(n.iter/2), inits = NULL, n.thin = 1, save_model = FALSE, prior = "default", center = FALSE, ... )
data |
A data frame in which to find the variables supplied in |
model.eff |
A formula expression in conventional |
model.cost |
A formula expression in conventional |
model.me |
A formula expression in conventional |
model.mc |
A formula expression in conventional |
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern'). |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR) and Missing Not At Random (MNAR). |
prob |
A numeric vector of probabilities within the range (0, 1), representing the upper and lower CI sample quantiles to be calculated and returned for the imputed values. |
n.chains |
Number of chains. |
n.iter |
Number of iterations. |
n.burnin |
Number of warmup iterations. |
inits |
A list with elements equal to the number of chains selected; each element of the list is itself a list of starting values for the
|
n.thin |
Thinning interval. |
save_model |
Logical. If |
prior |
A list containing the hyperprior values provided by the user. Each element of this list must be a vector
containing the user-provided prior distribution and parameter values and must be named with the name of the corresponding parameter. For example, the hyperprior
values for the standard deviation parameter for the effects can be provided using the list |
center |
Logical. If |
... |
Additional arguments that can be provided by the user. Examples are the additional arguments that can be provided to the function |
Depending on the distributions specified for the outcome variables in the arguments dist_e and
dist_c and the type of missingness mechanism specified in the argument type, different selection models
are built and run in the background by the function selection. These models consist in logistic regressions to estimate
the probability of missingness in one or both outcomes. A simple example can be used to show how selection models are specified.
Consider a data set comprising a response variable and a set of covariates , for . For each subject in the trial
we define an indicator variable taking value 1 if the -th individual is associated with a missing value and 0 otherwise.
This is modelled as:
where
is the individual probability of a missing value in .
represents the impact on the probability of a missing value in of the covariate .
represents the impact on the probability of a missing value in of the outcome values.
When the model assumes a 'MAR' mechanism, while when the mechanism is 'MNAR'. For the parameters indexing the missingness model,
the default prior distributions assumed are:
When user-defined hyperprior values are supplied via the argument prior in the function selection, the elements of this list (see Arguments)
must be vectors containing the user-provided distribution name and hyperprior values and must take specific names according to the parameters they are associated with.
Specifically, the names for the parameters indexing the model which are accepted by missingHE are the following:
auxiliary parameters : "sigma.prior.e"(effects) and/or "sigma.prior.c"(costs)
covariate parameters and : "alpha.prior"(effects) and/or "beta.prior"(costs)
covariate parameters in the missingness model (if covariate data provided): "gamma.prior.e"(effects) and/or "gamma.prior.c"(costs)
mnar parameter : "delta.prior.e"(effects) and/or "delta.prior.c"(costs)
For simplicity, here we have assumed that the set of covariates used in the models for the effects/costs and in the
model of the missing effect/cost values is the same. However, it is possible to specify different sets of covariates for each model
using the arguments in the function selection (see Arguments).
For each model, random effects can also be specified for each parameter by adding the term + (x | z) to each model formula, where x is the fixed regression coefficient for which also the random effects are desired and z is the clustering variable across which the random effects are specified (must be the name of a factor variable in the dataset). Multiple random effects can be specified using the notation + (x1 + x2 | site) for each covariate that was included in the fixed effects formula.
An object of the class 'missingHE' containing the following elements
A list containing the original data set provided in data (see Arguments). Additional information is also included about, among others,
the number of observed and missing individuals, the total number of individuals by treatment arm and the indicator vectors for the missing values
A list containing the output of a JAGS model generated from the functions jags, and
the posterior samples for the main parameters of the model
A list containing the output of the economic evaluation performed using the function bcea
A character variable that indicate which type of missing value mechanism used to run the model, either MAR or MNAR (see details)
A character variable that indicates which type of analysis was conducted, either using a wide or long dataset
Andrea Gabrio
Daniels, MJ. Hogan, JW. Missing Data in Longitudinal Studies: strategies for Bayesian modelling and sensitivity analysis, CRC/Chapman Hall.
Baio, G.(2012). Bayesian Methods in Health Economics. CRC/Chapman Hall, London.
Gelman, A. Carlin, JB., Stern, HS. Rubin, DB.(2003). Bayesian Data Analysis, 2nd edition, CRC Press.
Plummer, M. JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. (2003).
# Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the selection function assuming a SCAR mechanism # Use only 100 iterations to run a quick check model.selection <- selection(data = MenSS.subset, model.eff = e ~ trt, model.cost = c ~ trt, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.selection) # # Use dic information criterion to assess model fit pic.dic <- pic(model.selection, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.selection) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.selection, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posterior means and credible intervals) p1 <- plot(model.selection, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.selection) # Further examples which take longer to run model.selection <- selection(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, model.se = me ~ age, model.mc = mc ~ age, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.selection) # Use looic to assess model fit pic.looic <- pic(model.selection, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.selection, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.selection, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.selection) # ## Quck example to run using subset of MenSS dataset MenSS.subset <- MenSS[50:100, ] # Run the model using the selection function assuming a SCAR mechanism # Use only 100 iterations to run a quick check model.selection <- selection(data = MenSS.subset, model.eff = e ~ trt, model.cost = c ~ trt, model.me = me ~ 1, model.mc = mc ~ 1, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 100) # Print the results of the JAGS model print(model.selection) # # Use dic information criterion to assess model fit pic.dic <- pic(model.selection, criterion = "dic", cases = "cc") pic.dic # # Extract regression coefficient estimates coef(model.selection) # # Assess model convergence using graphical tools # Produce histograms of the posterior samples for the mean effects diag.hist <- diagnostic(model.selection, type = "histogram", param = "mu.e") # # Compare observed effect data with imputations from the model # using plots (posterior means and credible intervals) p1 <- plot(model.selection, class = "scatter", outcome = "effects") # # Summarise the CEA information from the model summary(model.selection) # Further examples which take longer to run model.selection <- selection(data = MenSS, model.eff = e ~ trt, model.cost = c ~ trt + e, model.se = me ~ age, model.mc = mc ~ age, dist_e = "norm", dist_c = "norm", type = "MAR", n.chains = 2, n.iter = 500) # # Print results for all imputed values print(model.selection) # Use looic to assess model fit pic.looic <- pic(model.selection, criterion = "looic", cases = "cc") pic.looic # Show density plots for mean costs parameters diag.den <- diagnostic(model.selection, type = "denplot", param = "mu.c") # Plots of imputations for all data p1 <- plot(model.selection, class = "scatter", outcome = "both") # Summarise the CEA results summary(model.selection) # #
missingHE
Produces a table printout with some summary results of the health economic evaluation probabilistic model
run using the function selection, pattern, hurdle or lmdm.
## S3 method for class 'missingHE' summary(object, incremental = FALSE, prob = c(0.025, 0.975), digits = 3, ...)## S3 method for class 'missingHE' summary(object, incremental = FALSE, prob = c(0.025, 0.975), digits = 3, ...)
object |
A |
incremental |
Logical. If |
prob |
A numeric vector of probabilities within the range (0, 1), representing the upper and lower CI quantiles to be calculated and returned for the posterior estimates. |
digits |
Integer indicating the number of decimal places to be used for rounding (default = 3). |
... |
Additional arguments affecting the summary produced. |
Prints tables with information on the CE results based on a model fitted using the function selection, pattern or hurdle.
Summary information on the main parameters of interests is provided.
Andrea Gabrio
Baio, G.(2012). Bayesian Methods in Health Economcis. CRC/Chapman Hall, London.
selection pattern hurdle lmdm diagnostic plot.missingHE
# For examples see the function selection, pattern or hurdle # ## For examples see the function selection, pattern or hurdle # #
An internal function to select which type of hurdle model to execute. Alternatives vary depending on the type of distribution assumed for the effect and cost variables, type of structural value mechanism assumed and independence or joint modelling This function selects which type of model to execute.
write_hurdle(dist_e, dist_c, type, model_txt_info)write_hurdle(dist_e, dist_c, type, model_txt_info)
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
type |
Type of structural value mechanism assumed. Choices are Structural Completely At Random (SCAR) and Structural At Random (SAR). |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
#Internal function only #No examples # ##Internal function only #No examples # #
An internal function to select which type of longitudinal missing data model to execute. Alternatives vary depending on the type of distribution assumed for the effect and cost variables, type of missingness mechanism assumed and independence or joint modelling This function selects which type of model to execute.
write_lmdm(dist_e, dist_c, type, model_txt_info)write_lmdm(dist_e, dist_c, type, model_txt_info)
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR) |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
#Internal function only #No examples # ##Internal function only #No examples # #
An internal function to select which type of pattern mixture model to execute. Alternatives vary depending on the type of distribution assumed for the effect and cost variables, type of missingness mechanism assumed and independence or joint modelling This function selects which type of model to execute.
write_pattern(dist_e, dist_c, type, model_txt_info)write_pattern(dist_e, dist_c, type, model_txt_info)
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR) |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
#Internal function only #No examples # ##Internal function only #No examples # #
An internal function to select which type of selection model to execute. Alternatives vary depending on the type of distribution assumed for the effect and cost variables, type of missingness mechanism assumed and independence or joint modelling This function selects which type of model to execute.
write_selection(dist_e, dist_c, type, model_txt_info)write_selection(dist_e, dist_c, type, model_txt_info)
dist_e |
Distribution assumed for the effects. Current available choices are: Normal ('norm'), Beta ('beta'), Gamma ('gamma'), Exponential ('exp'), Weibull ('weib'), Logistic ('logis'), Poisson ('pois'), Negative Binomial ('negbin') or Bernoulli ('bern') |
dist_c |
Distribution assumed for the costs. Current available choices are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm') |
type |
Type of missingness mechanism assumed. Choices are Missing At Random (MAR), Missing Not At Random for the effects (MNAR_eff), Missing Not At Random for the costs (MNAR_cost), and Missing Not At Random for both (MNAR) |
model_txt_info |
list containing model specification information used to write the txt file of the JAGS model. |
#Internal function only #No examples # ##Internal function only #No examples # #