For models where brms provides pp_check support, this method delegates to
brms::pp_check(). For models with multinomial families (e.g., the m3
model), brms's pp_check is unavailable; this method dispatches to a
model-specific visualisation instead.
Usage
# S3 method for class 'bmmfit'
pp_check(
object,
type = NULL,
ndraws = NULL,
group = NULL,
resp_var = NULL,
...
)Arguments
- object
A
bmmfitobject returned bybmm().- type
Character. Type of pp_check. When
NULL(default), resolves to"dens_overlay", or to the selected observable's default type whenresp_varis specified. Whengroupis specified, the grouped variant (e.g.,"dens_overlay_grouped") is auto-selected if available. Multinomial models produce a response proportion profile regardless of the value supplied. Withresp_var,type = "bars_binned"is also available: it bins a continuous statistic like a histogram, with bars for the observed number of observations per bin and points with intervals for the predicted number. It is the default for theezdm()accuracy check.- ndraws
Integer. Number of posterior draws. Defaults to
100for multinomial models and10whenresp_varis specified; otherwise passed tobrms::pp_check().- group
Character. Optional grouping variable for faceting. For non-multinomial models, passed to
brms::pp_check(); when specified, the grouped variant oftype(e.g.,"dens_overlay_grouped") is auto-selected if available. For multinomial models, facets by the named predictor.- resp_var
Character. For models that declare several observables, the name of the observable to check, or
"all"for a panel of all available checks built from one shared simulation. Seepp_check_vars()for the options of a fitted model. The defaultNULLchecks the primary response viabrms::pp_check(), except for anezdm(version = "4par")fit in which some cells have no usable summaries at the upper boundary: the primary response,mean_rt_upper, holds placeholders there, soNULLmeansresp_var = "mean_rt_upper", which leaves those cells out but takes neithernewdatanor theloo_*types. For the RT models, passingnegative_rt = TRUE(abrms::posterior_predict()argument) is redirected toresp_var = "signed_rt", so that observed and predicted response times are both signed by the response.- ...
Additional arguments. Without
resp_var, forwarded tobrms::pp_check(), or for multinomial models tobrms::posterior_predict()(probs, a numeric vector of length 2 with defaultc(0.025, 0.975), sets the credible interval). Withresp_var,draw_idsandre_formulago tobrms::prepare_predictions()and the rest to thebayesplot::ppc_*function.type = "bars_binned"takesbreaks(bin edges that cover the observed and predicted values),prob(interval width, default0.9) andfreq(FALSEfor proportions instead of counts).re_formula = NApredicts at the population level on every path.
Value
For multinomial models, for a 4-parameter ezdm() fit with
placeholders in mean_rt_upper, or when resp_var is specified, a
ggplot2 object (a bayesplot_grid for resp_var = "all"). For other
models, the result of brms::pp_check().
Details
For multinomial models, the plot mirrors the bayesplot ppc_bars style:
observed proportions are shown as bars and posterior predictive medians with
credible intervals are shown as point-ranges, using the bayesplot default
colour scheme and theme.
Some models describe several observables jointly (e.g. ddm(): response
times and responses; ezdm(): mean RT, RT variance and accuracy), but
brms only ever checks the primary response. For these models the resp_var
argument selects which observable to check; pp_check_vars() lists the
available checks. All selected observables are drawn from one joint
posterior predictive simulation, so resp_var = "all" panels are mutually
consistent.
Some observables are undefined for some cells — an ezdm() boundary has no
mean response time when fewer than two responses reach it. Observations
whose observed value is undefined are dropped from the check; undefined
values in the simulated replicates are absorbed by dropping those
posterior draws instead, so the number of observations checked does not
depend on ndraws. Dropped draws are not missing at random — they are
draws whose parameters made a boundary sparse — so the retained predictive
is mildly conditioned; both reductions are reported with a warning. With
resp_var = "all" one reduction is shared by every panel, so the panels
are computed on the same observations and draws.
