posterior_epred.bmmfit: Expected response of a fitted bmm model

View source: R/helpers-postprocess.R

posterior_epred.bmmfitR Documentation

Expected response of a fitted bmm model

Description

posterior_epred() returns draws of the expected value of the response for each observation: the mean of what brms::posterior_predict() simulates for it. What that is depends on the model:

Model Expected response
ddm(), cswald() Mean response time, averaged over both responses, under the diffusion process that posterior_predict() simulates from
ezdm(), version "3par" Mean response time of the cell
ezdm(), version "4par" Mean response time of the cell's upper-boundary responses
sdt_yn() Number of "old"/"signal" responses, the number of trials times their probability
sdt_mafc() Number of correct responses, the number of trials times their probability
m3(), sdt_rating(), sdt_ranking(), sdt_cdp() Expected count of each response category, from the multinomial family of brms
sdm(), mixture2p(), mixture3p(), imm() Not defined: the mean of a circular response error is not a useful quantity, so these models stop with an error

With dpar or nlpar, posterior_epred() returns draws of that model parameter for every model, as in brms: a dpar on its native scale, an nlpar on the scale of its link. native_parameters() returns the model parameters on their native scale over a grid of predictor values.

Usage

## S3 method for class 'bmmfit'
posterior_epred(object, ..., dpar = NULL, nlpar = NULL)

## S3 method for class 'bmmfit'
fitted(object, ..., scale = c("response", "linear"), dpar = NULL, nlpar = NULL)

Arguments

object

A bmmfit object.

...

Further arguments passed to brms::posterior_epred(), such as newdata or ndraws.

dpar, nlpar

Name of a distributional or non-linear parameter whose draws are returned instead of the expected response.

scale

As in brms::fitted.brmsfit(): "response" is the expected response, "linear" the linear predictor of mu.

Value

A draws by observations matrix (an array with a third dimension for the response categories of the multinomial models).

See Also

brms::posterior_epred(), native_parameters()

Examples

## Not run: 
fit <- bmm(
  bmf(drift ~ 1, bound ~ 1, ndt ~ 1),
  data = rddm(200, drift = 1.5, bound = 1.2, ndt = 0.3),
  model = ddm(rt = "rt", response = "response"),
  backend = "cmdstanr"
)
# expected response time of each observation, one row per draw
epred <- posterior_epred(fit)

## End(Not run)

bmm documentation built on Oct. 16, 2026, 9:08 a.m.