p_check: Plot predictive checks

p_checkR Documentation

Plot predictive checks

Description

Gets predictive samples (prior or posterior) from a brms model. Generates a histogram comparing distributions of samples (and optionally to the data) and returns a dataframe containing these predictions.

Usage

p_check(
  model,
  show_data = FALSE,
  n_samples = 10,
  samples = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  ignore_extreme = TRUE,
  re_formula = NULL,
  ...
)

Arguments

model

the brms model to use for prediction.

show_data

if TRUE, actual data is compared to predictions.

n_samples

the number of samples to be drawn.

samples

A number or vector of specific samples to be drawn. If not provided, random samples are selected.

xlim

plot x axis limits.

ylim

plot y axis limits.

xlab

x axis label.

ylab

y axis label.

ignore_extreme

should extreme values be ignored? This is useful for response distributions with large outliers such as t.

re_formula

formula containing group-level effects to be considered in the prediction. If NULL (default), include all group-level effects; if NA, include no group-level effects.

...

additional arguments are passed to the internal call of plot().

Examples

## Not run: 
model_height_vtl = bmmb::get_model("11_model_height_vtl_f0")

samples = bmmb::p_check (model_height_vtl, show_data=TRUE)
head (samples)

## End(Not run)

santiagobarreda/bmmb documentation built on June 11, 2024, 5:33 p.m.