pp_check: Posterior Predictive Checks For Mcpfit Objects

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plot.R

Description

Plot posterior (default) or prior (prior = TRUE) predictive checks. This is convenience wrapper around the bayesplot::ppc_*() methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pp_check(
  object,
  type = "dens_overlay",
  facet_by = NULL,
  newdata = NULL,
  prior = FALSE,
  varying = TRUE,
  arma = TRUE,
  nsamples = 100,
  ...
)

Arguments

object

An mcpfit object.

type

One of bayesplot::available_ppc("grouped", invert = TRUE) %>% stringr::str_remove("ppc_")

facet_by

Name of a column in data modeled as varying effect(s).

newdata

A tibble or a data.frame containing predictors in the model. If NULL (default), the original data is used.

prior

TRUE/FALSE. Plot using prior samples? Useful for mcp(..., sample = "both")

varying
  • TRUE: All varying effects (fit$pars$varying).

    • FALSE: No varying efects (c()).

    • Character vector: Only include specified varying parameters - see fit$pars$varying.

arma

Whether to include autoregressive effects.

  • TRUE: Compute autoregressive residuals. Requires the response variable in newdata.

  • FALSE: Disregard the autoregressive effects. For family = gaussian(), predict() just use sigma for residuals.

nsamples

Number of draws. Note that you may want to use all data for summary geoms. e.g., pp_check(fit, type = "ribbon", nsamples = NULL).

...

Further arguments passed to bayesplot::ppc_type(y, yrep, ...)

Value

A ggplot2 object for single plots. Enriched by patchwork for faceted plots.

Author(s)

Jonas Kristoffer Lindeløv jonas@lindeloev.dk

See Also

plot.mcpfit pp_eval

Examples

1
2
3
pp_check(ex_fit)
pp_check(ex_fit, type = "ecdf_overlay")
#pp_check(some_varying_fit, type = "loo_intervals", facet_by = "id")

mcp documentation built on Aug. 3, 2020, 5:07 p.m.