Compute exact cross-validation for problematic observations for which approximate leave-one-out cross-validation may return incorrect results. Models for problematic observations can be run in parallel using the future package.
# S3 method for brmsfit
reloo(x, loo, k_threshold = 0.7, newdata = NULL,
resp = NULL, check = TRUE, ...)# S3 method for loo
reloo(x, fit, ...)
reloo(x, ...)
An R object of class brmsfit
or loo
depending
on the method.
An R object of class loo
.
The threshold at which pareto 0.7
.
See pareto_k_ids
for more details.
An optional data.frame for which to evaluate predictions. If
NULL
(default), the original data of the model is used.
Optional names of response variables. If specified, predictions are performed only for the specified response variables.
Logical; If TRUE
(the default), some checks
check are performed if the loo
object was generated
from the brmsfit
object passed to argument fit
.
Further arguments passed to
update.brmsfit
and log_lik.brmsfit
.
An R object of class brmsfit
.
An object of the class loo
.
Warnings about Pareto k_threshold
, then reloo
will refit the original model
loo
object.
# NOT RUN {
fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
data = epilepsy, family = poisson())
# throws warning about some pareto k estimates being too high
(loo1 <- loo(fit1))
(reloo1 <- reloo(fit1, loo = loo1, chains = 1))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab