diagnostic: Diagnostic checks for assessing MCMC convergence of Bayesian...

View source: R/diagnostic.R

diagnosticR Documentation

Diagnostic checks for assessing MCMC convergence of Bayesian models fitted in JAGS using the function selection, selection_long, pattern or hurdle

Description

The focus is restricted to full Bayesian models in cost-effectiveness analyses based on the function selection, selection_long, pattern and hurdle, 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 and mcmcplots. Graphics and plots are managed using functions contained in the package ggplot2 and ggthemes.

Usage

diagnostic(x, type = "denplot", param = "all", theme = NULL, ...)

Arguments

x

An object of class "missingHE" containing the posterior results of a full Bayesian model implemented using the function selection, selection_long, pattern or hurdle.

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 crosscorrelation plots, 'Rhat' for the potential scale reduction factor, 'geweke' for the geweke diagnostic, 'pairs' for posterior correlation among the parameters,'caterpillar' for caterpillar plots. In addition the class 'summary' provides an overview of some of the most popular diagnostic checks for each parameter selected.

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' ('mu.u' for longitudinal models) 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. For a full list of available themes see details.

...

Additional parameters that can be provided to manage the graphical output of diagnostic.

Details

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. If x contains the results from a longitudinal model, all parameter names indexed by "e" should be instead indexed by "u". The available names and the parameters associated with them are:

  • "mu.e" the mean parameters of the effect variables in the two treatment arms.

  • "mu.c" the mean parameters of the cost variables in the two treatment arms.

  • "mu.e.p" the pattern-specific mean parameters of the effect variables in the two treatment arms (only with the function pattern).

  • "mu.c.p" the pattern-specific mean parameters of the cost variables in the two treatment arms (only with the function pattern).

  • "sd.e" the standard deviation parameters of the effect variables in the two treatment arms.

  • "sd.c" the standard deviation parameters of the cost variables in the two treatment arms.

  • "alpha" the regression intercept and covariate coefficient parameters for the effect variables in the two treatment arms.

  • "beta" the regression intercept and covariate coefficient parameters for the cost variables in the two treatment arms.

  • "random.alpha" the regression random effects intercept and covariate coefficient parameters for the effect variables in the two treatment arms.

  • "random.beta" the regression random effects intercept and covariate coefficient parameters for the cost variables in the two treatment arms.

  • "p.e" the probability parameters of the missingness or structural values mechanism for the effect variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "p.c" the probability parameters of the missingness or structural values mechanism for the cost variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "gamma.e" the regression intercept and covariate coefficient parameters of the missingness or structural values mechanism for the effect variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "gamma.c" the regression intercept and covariate coefficient parameters of the missingness or structural values mechanism for the cost variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "random.gamma.e" the random effects regression intercept and covariate coefficient parameters of the missingness or structural values mechanism for the effect variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "random.gamma.c" the random effects regression intercept and covariate coefficient parameters of the missingness or structural values mechanism for the cost variables in the two treatment arms (only with the function selection, selection_long or hurdle).

  • "pattern" the probabilities associated with the missingness patterns in the data (only with the function pattern).

  • "delta.e" the mnar parameters of the missingness mechanism for the effect variables in the two treatment arms (only with the function selection, selection_long, or pattern).

  • "delta.c" the mnar parameters of the missingness mechanism for the cost variables in the two treatment arms (only with the function selection, selection_long, or pattern).

  • "random.delta.e" the random effects mnar parameters of the missingness mechanism for the effect variables in the two treatment arms (only with the function selection or selection_long).

  • "random.delta.c" the random effects mnar parameters of the missingness mechanism for the cost variables in the two treatment arms (only with the function selection or selection_long).

  • "all" all available parameters stored in the object 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, selection_long, or pattern, 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.

Value

A ggplot object containing the plots specified in the argument type

Author(s)

Andrea Gabrio

References

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.

See Also

ggs selection, selection_long, pattern hurdle.

Examples

# For examples see the function \code{\link{selection}}, \code{\link{selection_long}},
# \code{\link{pattern}} or \code{\link{hurdle}}
#
#

missingHE documentation built on March 31, 2023, 10:27 p.m.