View source: R/pp_check.greta_mcmc_list.r
pp_check.greta_mcmc_list | R Documentation |
greta_mcmc_list
objectPerform posterior predictive checks with the help of the package bayesplot
## S3 method for class 'greta_mcmc_list' pp_check(object, y, nsim = 10, type = "dens_overlay", ...)
object |
A greta_mcmc_list object obtained from the greta::mcmc function |
y |
A greta array of the response variable, see example |
nsim |
A numeric, the number of posterior simulation to draw, default is 10 |
type |
A character string, the type of posterior predictive plot to draw. See |
... |
Further arguments passed to ppc_* functions, check the possibilities there. |
For a detailed explanation of each of the implemented ppc functions, see PPC-overview
.
Note that LOO and Discrete ppc_* function are not yet available for greta models.
A ggplot object that can be further modified using the ggplot2 package.
## Not run: x <- runif(100, -2, 2) y <- rnorm(100, 1 + 2 * x, 1) # need the pass the response vector as greta array y <- as_data(y) intercept <- normal(0, 2) slope <- normal(0, 1) linpred <- intercept + slope * x sd_res <- cauchy(0, 2, truncation = c(0, Inf)) distribution(y) <- normal(linpred, sd_res) m <- model(intercept, slope, sd_res) d <- mcmc(m, warmup = 10, n_samples = 10) # default use pp_check(d, y) # check some options pp_check(d, y, nsim = 4, type = "scatter_avg") pp_check(d, y, type = "hist") pp_check(d, y, type = "error_scatter") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.