ppc: Posterior predictive checks for assessing the fit to the...

View source: R/ppc.R

ppcR Documentation

Posterior predictive checks for assessing the fit to the observed data of Bayesian models implemented 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 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.

Usage

ppc(
  x,
  type = "histogram",
  outcome = "all",
  ndisplay = 15,
  time_plot = NULL,
  theme = NULL,
  scheme_set = NULL,
  legend = "top",
  ...
)

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 posterior predictive check to be plotted for assessing model fit. Available choices include: 'histogram', 'boxplot', 'freqpoly', 'dens', 'dens_overlay' and ecdf_overlay', which compare the empirical and repicated distributions of the data; 'stat' and 'stat_2d', which compare the value of some statistics evaluated on the observed data with the replicated values for those statistics from the posterior predictions; 'error_hist', 'error_scatter', 'error_scatter_avg' and 'error_binned', which display the predictive errors of the model; 'intervals' and 'ribbon', which compare medians and central interval estimates of the replications with the observed data overlaid; 'scatter' and 'scatter_avg', which display scatterplots of the observed and replicated data.

outcome

The outcome variables that should be displayed. Use the names 'effects_arm1' and effects_arm2' for the effectiveness in the control and intervention arm; use costs_arm1' or 'costs_arm2' for the costs; use "effects" or "costs" for the respective outcome in both arms; use "all" for all outcomes.

ndisplay

Number of posterior replications to be displayed in the plots.

time_plot

Time point for which posterior predictive checks should be displayed (only for longitudinal models).

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.

legend

Position of the legend: available choices are: "top", "left", "right", "bottom" and "none".

...

Additional parameters that can be provided to manage the output of ppc. For more details see bayesplot.

Details

The funciton produces different types of graphical posterior predictive checks using the estimates from a Bayesian cost-effectiveness model implemented with the function selection, selection_long, pattern or hurdle. 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.

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.

See Also

selection, selection_long, pattern hurdle diagnostic

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.