pattern | R Documentation |
Full Bayesian cost-effectiveness models to handle missing data in the outcomes under different missingness
mechanism assumptions, using alternative parametric distributions for the effect and cost variables and a pattern mixture 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,
Delta_e,
Delta_c,
type,
restriction = "CC",
prob = c(0.025, 0.975),
n.chains = 2,
n.iter = 20000,
n.burnin = floor(n.iter/2),
inits = NULL,
n.thin = 1,
ppc = FALSE,
save_model = FALSE,
prior = "default",
...
)
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 chocies 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 chocies are: Normal ('norm'), Gamma ('gamma') or LogNormal ('lnorm'). |
Delta_e |
Range of values for the prior on the sensitivity parameters used to identify the mean of the effects under MNAR. The value must be set to 0 under MAR. |
Delta_c |
Range of values for the prior on the sensitivity parameters used to identify the mean of the costs under MNAR. The value must be set to 0 under MAR. |
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. |
ppc |
Logical. If |
save_model |
Logical. If |
prior |
A list containing the hyperprior values provided by the user. Each element of this list must be a vector of length two
containing the user-provided hyperprior values and must be named with the name of the corresponding parameter. For example, the hyperprior
values for the standard deviation effect parameters can be provided using the list |
... |
Additional arguments that can be provided by the user. Examples are |
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 y
and a set of centered covariate X_j
. We denote with d_i
the patterns' indicator variable for each
subject in the trial i = 1, ..., n
such that: d_i = 1
indicates the completers (both e and c observed), d_i = 2
and d_i = 3
indicate that
only the costs or effects are observed, respectively, while d_i = 4
indicates that neither of the two outcomes is observed. In general, a different number of patterns
can be observed between the treatment groups and missingHE
accounts for this possibility by modelling a different patterns' indicator variables for each arm.
For simplicity, in this example, we assume that the same number of patterns is observed in both groups. d_i
is assigned a multinomial distribution,
which probabilities are modelled using a Dirichlet prior (by default giving to each pattern the same weight). Next, the model specified in dist_e
and dist_c
is fitted in each pattern. The parameters that cannot be identified by the observed data in each pattern (d = 2, 3, 4), e.g. the means.
mu_e[d]
and mu_c[d]
, can be identified using 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:
mu_e[2] = \mu_e[4] = \mu_e[1] + \Delta_e
mu_c[3] = \mu_c[4] = \mu_c[1] + \Delta_c
where
\mu_e[1]
is the effects mean for the completers.
\mu_c[1]
is the costs mean for the completers.
\Delta_e
is the sensitivity parameters associated with the marginal effects mean.
\Delta_c
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 \Delta_e = 0
and \Delta_c = 0
the model assumes a 'MAR' mechanism. When \Delta_e != 0
and/or \Delta_c != 0
'MNAR' departues for the
effects and/or costs are explored assuming a Uniform prior distributions for the sensitivity parameters. The range of values for these priors is defined based on the
boundaries specified in Delta_e
and Delta_c
(see Arguments), which must be provided by the user.
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 of length two containing the user-provided 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:
location parameters \alpha_0
and \beta_0
: "mean.prior.e"(effects) and/or "mean.prior.c"(costs)
auxiliary parameters \sigma
: "sigma.prior.e"(effects) and/or "sigma.prior.c"(costs)
covariate parameters \alpha_j
and \beta_j
: "alpha.prior"(effects) and/or "beta.prior"(costs)
The only exception is the missingness patterns' probability \pi
, denoted with "patterns.prior", whose hyperprior values must be provided as a list
formed by two elements. These must be vectors of the same length equal to the number of patterns in the control (first element) and intervention (second element) group.
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. Random intercepts are included by default in the models if a random effects are specified but they can be removed by adding the term 0 within the random effects formula, e.g. + (0 + x | z).
An object of the class 'missingHE' containing the following elements
A list containing the original data set provided in data
(see Arguments), 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 and the imputed values
A list containing the output of the economic evaluation performed using the function bcea
A character variable that indicate which type of missingness assumption has been used to run the model,
either MAR
or MNAR
(see details)
A character variable that indicate which type of analysis was conducted, either using a wide
or longitudinal
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).
jags
, bcea
# Quck example to run using subset of MenSS dataset
MenSS.subset <- MenSS[50:100, ]
# Run the model using the pattern function assuming a SCAR mechanism
# Use only 100 iterations to run a quick check
model.pattern <- pattern(data = MenSS.subset,model.eff = e~1,model.cost = c~1,
dist_e = "norm", dist_c = "norm",type = "MAR", Delta_e = 0, Delta_c = 0,
n.chains = 2, n.iter = 100, ppc = FALSE)
# 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", module = "total")
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 ~ u.0,model.cost = c ~ e,
Delta_e = 0, Delta_c = 0, dist_e = "norm", dist_c = "norm",
type = "MAR", n.chains = 2, n.iter = 500, ppc = FALSE)
#
# Print results for all imputed values
print(model.pattern, value.mis = TRUE)
# Use looic to assess model fit
pic.looic<-pic(model.pattern, criterion = "looic", module = "total")
pic.looic
# Show density plots for all parameters
diag.hist <- diagnostic(model.pattern, type = "denplot", param = "all")
# Plots of imputations for all data
p1 <- plot(model.pattern, class = "scatter", outcome = "all")
# Summarise the CEA results
summary(model.pattern)
#
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.