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

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ppc.R

Description

The focus is restricted to full Bayesian models in cost-effectiveness analyses based on the function selection, 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ppc(
  x,
  type = "histogram",
  outcome = "all",
  ndisplay = 15,
  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, 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 estmates 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.

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

Examples

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

missingHE documentation built on July 1, 2020, 5:50 p.m.