Compute the Pointwise Log-Likelihood
# S3 method for brmsfit
newdata = NULL,
re_formula = NULL,
resp = NULL,
ndraws = NULL,
draw_ids = NULL,
pointwise = FALSE,
combine = TRUE,
add_point_estimate = FALSE,
cores = NULL,
A fitted model object of class
An optional data.frame for which to evaluate predictions. If
NULL (default), the original data of the model is used.
NA values within factors are interpreted as if all dummy
variables of this factor are zero. This allows, for instance, to make
predictions of the grand mean when using sum coding.
formula containing group-level effects to be considered in
the prediction. If
NULL (default), include all group-level effects;
NA, include no group-level effects.
Optional names of response variables. If specified, predictions are performed only for the specified response variables.
Positive integer indicating how many posterior draws should
be used. If
NULL (the default) all draws are used. Ignored if
draw_ids is not
An integer vector specifying the posterior draws to be used.
NULL (the default), all draws are used.
A flag indicating whether to compute the full
log-likelihood matrix at once (the default), or just return
the likelihood function along with all data and draws
required to compute the log-likelihood separately for each
observation. The latter option is rarely useful when
log_lik directly, but rather when computing
Only relevant in multivariate models. Indicates if the log-likelihoods of the submodels should be combined per observation (i.e. added together; the default) or if the log-likelihoods should be returned separately.
For internal use only. Ensures compatibility
Number of cores (defaults to
1). On non-Windows systems,
this argument can be set globally via the
Further arguments passed to
that control several aspects of data validation and prediction.
Usually, an S x N matrix containing the pointwise log-likelihood draws, where S is the number of draws and N is the number of observations in the data. For multivariate models and if
FALSE, an S x N x R array is returned,
where R is the number of response variables.
pointwise = TRUE, the output is a function
draws attribute containing all relevant
data and posterior draws.
NA values within factors in
are interpreted as if all dummy variables of this factor are
zero. This allows, for instance, to make predictions of the grand mean
when using sum coding.
In multilevel models, it is possible to
allow new levels of grouping factors to be used in the predictions.
This can be controlled via argument
New levels can be sampled in multiple ways, which can be controlled
sample_new_levels. Both of these arguments are
prepare_predictions along with several
other useful arguments to control specific aspects of the predictions.