plot_ppc.bgmfit {bsitar} | R Documentation |
Perform posterior predictive distribution checks
Description
Perform posterior predictive checks with the help of the bayesplot package.
Usage
## S3 method for class 'bgmfit'
plot_ppc(
model,
type,
ndraws = NULL,
draw_ids = NULL,
prefix = c("ppc", "ppd"),
group = NULL,
x = NULL,
newdata = NULL,
resp = NULL,
size = 0.25,
alpha = 0.7,
trim = FALSE,
bw = "nrd0",
adjust = 1,
kernel = "gaussian",
n_dens = 1024,
pad = TRUE,
discrete = FALSE,
binwidth = NULL,
bins = NULL,
breaks = NULL,
freq = TRUE,
y_draw = c("violin", "points", "both"),
y_size = 1,
y_alpha = 1,
y_jitter = 0.1,
verbose = FALSE,
deriv_model = NULL,
dummy_to_factor = NULL,
expose_function = FALSE,
usesavedfuns = NULL,
clearenvfuns = NULL,
envir = NULL,
...
)
plot_ppc(model, ...)
Arguments
model |
An object of class |
type |
Type of the ppc plot as given by a character string.
See |
ndraws |
A positive integer indicating the number of posterior draws to
be used in estimation. If |
draw_ids |
An integer indicating the specific posterior draw(s)
to be used in estimation (default |
prefix |
The prefix of the bayesplot function to be applied. Either '"ppc"' (posterior predictive check; the default) or '"ppd"' (posterior predictive distribution), the latter being the same as the former except that the observed data is not shown for '"ppd"'. |
group |
Optional name of a factor variable in the model
by which to stratify the ppc plot. This argument is required for
ppc |
x |
Optional name of a variable in the model.
Only used for ppc types having an |
newdata |
An optional data frame to be used in estimation. If
|
resp |
A character string (default |
size , alpha |
Passed to the appropriate geom to control the appearance of the predictive distributions. |
trim |
A logical scalar passed to |
bw , adjust , kernel , n_dens |
Optional arguments passed to
|
pad |
A logical scalar passed to |
discrete |
For |
binwidth |
Passed to |
bins |
Passed to |
breaks |
Passed to |
freq |
For histograms, |
y_draw |
For |
y_jitter , y_size , y_alpha |
For |
verbose |
An optional argument (logical, default |
deriv_model |
A logical to specify whether to estimate velocity curve
from the derivative function, or the differentiation of the distance curve.
The argument |
dummy_to_factor |
A named list (default |
expose_function |
An optional logical argument to indicate whether to
expose Stan functions (default |
usesavedfuns |
A logical (default |
clearenvfuns |
A logical to indicate whether to clear the exposed
function from the environment ( |
envir |
Environment used for function evaluation. The default is
|
... |
Additional arguments passed to the |
Details
The plot_ppc() is a wrapper around the brms::pp_check()
.
Value
A ggplot object that can be further customized using the ggplot2 package.
Author(s)
Satpal Sandhu satpal.sandhu@bristol.ac.uk
Examples
# Fit Bayesian SITAR model
# To avoid mode estimation which takes time, the Bayesian SITAR model fit to
# the 'berkeley_exdata' has been saved as an example fit ('berkeley_exfit').
# See 'bsitar' function for details on 'berkeley_exdata' and 'berkeley_exfit'.
# Check and confirm whether model fit object 'berkeley_exfit' exists
berkeley_exfit <- getNsObject(berkeley_exfit)
model <- berkeley_exfit
plot_ppc(model, ndraws = 100)