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, pattern, hurdle or lmdm

Description

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.

Usage

ppc(
  x,
  type = "histogram",
  outcome = "both",
  ndisplay = 15,
  trt = "all",
  theme = NULL,
  scheme_set = NULL,
  ...
)

Arguments

x

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

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 ppc. For more details see bayesplot.

Details

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.

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 pattern hurdle lmdm diagnostic

Examples

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

missingHE documentation built on March 19, 2026, 5:06 p.m.