log_lik.brmsfit  R Documentation 
Compute the Pointwise LogLikelihood
## S3 method for class 'brmsfit' log_lik( object, newdata = NULL, re_formula = NULL, resp = NULL, ndraws = NULL, draw_ids = NULL, pointwise = FALSE, combine = TRUE, add_point_estimate = FALSE, cores = NULL, ... )
object 
A fitted model object of class 
newdata 
An optional data.frame for which to evaluate predictions. If

re_formula 
formula containing grouplevel effects to be considered in
the prediction. If 
resp 
Optional names of response variables. If specified, predictions are performed only for the specified response variables. 
ndraws 
Positive integer indicating how many posterior draws should
be used. If 
draw_ids 
An integer vector specifying the posterior draws to be used.
If 
pointwise 
A flag indicating whether to compute the full
loglikelihood matrix at once (the default), or just return
the likelihood function along with all data and draws
required to compute the loglikelihood separately for each
observation. The latter option is rarely useful when
calling 
combine 
Only relevant in multivariate models. Indicates if the loglikelihoods of the submodels should be combined per observation (i.e. added together; the default) or if the loglikelihoods should be returned separately. 
add_point_estimate 
For internal use only. Ensures compatibility
with the 
cores 
Number of cores (defaults to 
... 
Further arguments passed to 
NA
values within factors in newdata
,
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 allow_new_levels
.
New levels can be sampled in multiple ways, which can be controlled
via argument sample_new_levels
. Both of these arguments are
documented in prepare_predictions
along with several
other useful arguments to control specific aspects of the predictions.
Usually, an S x N matrix containing the pointwise loglikelihood
draws, where S is the number of draws and N is the number
of observations in the data. For multivariate models and if
combine
is FALSE
, an S x N x R array is returned,
where R is the number of response variables.
If pointwise = TRUE
, the output is a function
with a draws
attribute containing all relevant
data and posterior draws.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.