Posterior probability that each response was generated by the outlier
component rather than by the decision process, for a model fitted with any
family built on the outlier mixture - cogmod_lognormal(), cogmod_loggamma(),
cogmod_lnr() and the rest listed in the Supported families section of
cogmod_priors(). This is the mixture responsibility
poutlier * g(rt) / (poutlier * g(rt) + (1 - poutlier) * f(rt - ndt)),
averaged over posterior draws.
Responses faster than ndt come out at 1, responses in the heart of the
distribution near 0, and responses in either tail somewhere in between - the
model discriminates by evidence rather than by a cutoff. A response in the
middle can still be an outlier; a low probability means the data cannot tell,
not that the trial is clean.
Averaging the responsibility over draws gives P(trial i came from the outlier component | data) directly, so the posterior mean is the quantity
of interest and there is no interval to report alongside it. Pass
summary = FALSE for the raw draws if you need the spread.
Arguments
- object
A
brmsfitfitted withcogmod_lognormal(),cogmod_loggamma()or any other family built on the outlier mixture - see the Supported families section ofcogmod_priors().- summary
Logical; if
TRUE(default) returns a data frame with one row per observation. IfFALSE, returns the full draws x observations matrix.
Value
A data frame with columns rt and p_outlier, in the order the
observations appear in the model frame, or a draws x observations matrix if
summary = FALSE.
Examples
# \donttest{
# Fitting needs cmdstanr, which lives outside CRAN - see the package website.
if (requireNamespace("cmdstanr", quietly = TRUE) &&
!is.null(cmdstanr::cmdstan_version(error_on_NA = FALSE))) {
df <- data.frame(RT = rcogmod_lognormal(200, ndt = 0.3, poutlier = 0.05))
f <- brms::bf(RT ~ 1, ndt ~ 1, poutlier ~ 1, family = cogmod_lognormal())
m <- brms::brm(f,
data = df, stanvars = cogmod_stanvars(f),
prior = cogmod_priors(f, df), init = cogmod_inits(f, df),
backend = "cmdstanr", chains = 1, iter = 500, refresh = 0
)
head(p_outlier(m))
}
# }