ppc_plots function

Plotting for MCMC visualization and diagnostics provided by bayesplot package

Plotting for MCMC visualization and diagnostics provided by bayesplot package

Plots of Rhat statistics, ratios of effective sample size to total sample size, and autocorrelation of MCMC draws.

ppc_dens(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_dens(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_dens(object, ...) ppc_dens_overlay(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_dens_overlay(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_dens_overlay(object, ...) ppc_hist(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_hist(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_hist(object, ...) ppc_boxplot(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_boxplot(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_boxplot(object, ...) ppc_freqpoly(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_freqpoly(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_freqpoly(object, ...) ppc_ecdf_overlay(object, ...) ## S4 method for signature 'bayesGAMfit' ppc_ecdf_overlay(object, draws = NULL, ...) ## S4 method for signature 'posteriorPredictObject' ppc_ecdf_overlay(object, ...)

Arguments

  • object: an object of class bayesGAMfit
  • ...: optional additional arguments to pass to the bayesplot functions
  • draws: An integer indicating the number of draws to return. The default and maximum number of draws is the size of the posterior sample.

Returns

These functions call various plotting functions from the bayesplot package, which returns a list including ggplot2 objects.

Plot Descriptions from the bayesplot package documentation

  • ppc_hist(object, draws=NULL, ...)A separate histogram estimate is displayed for y and each dataset (row) in yrep. For these plots yrep should therefore contain only a small number of rows.
  • ppc_boxplot(object, draws=NULL, ...)A separate box and whiskers plot is displayed for y and each dataset (row) in yrep. For these plots yrep should therefore contain only a small number of rows.
  • ppc_freqpoly(object, draws=NULL, ...)A separate shaded frequency polygon is displayed for y and each dataset (row) in yrep. For these plots yrep should therefore contain only a small number of rows.
  • ppc_dens(object, draws=NULL, ...)A separate smoothed kernel density estimate is displayed for y and each dataset (row) in yrep. For these plots yrep should therefore contain only a small number of rows.
  • ppc_dens_overlay(object, draws=NULL, ...)Kernel density estimates of each dataset (row) in yrep are overlaid, with the distribution of y itself on top (and in a darker shade).
  • ppc_ecdf_overlay(object, draws=NULL, ...)Empirical CDF estimates of each dataset (row) in yrep are overlaid, with the distribution of y itself on top (and in a darker shade).

Examples

f <- bayesGAM(weight ~ np(height), data = women, family = gaussian, iter=500, chains = 1) ppc_dens(f, draws=2)

References

Gabry, Jonah and Mahr, Tristan (2019). bayesplot: Plotting for Bayesian Models. https://mc-stan.org/bayesplot/

Gabry, J., Simpson, D., Vehtari, A., Betancourt, M., and Gelman, A (2019). Visualization in Bayesian Workflow. Journal of the Royal Statistical Society: Series A. Vol 182. Issue 2. p.389-402.

Gelman, A. and Rubin, D. (1992) Inference from Iterative Simulation Using Multiple Sequences. Statistical Science 7(4) 457-472.

Gelman, A., et. al. (2013) Bayesian Data Analysis. Chapman and Hall/CRC.

Gabry, J. , Simpson, D. , Vehtari, A. , Betancourt, M. and Gelman, A. (2019), Visualization in Bayesian workflow. J. R. Stat. Soc. A, 182: 389-402. doi:10.1111/rssa.12378.

  • Maintainer: Samuel Thomas
  • License: GPL-3
  • Last published: 2022-03-17

Useful links