Moment matching for efficient approximate leave-one-out cross-validation
Moment matching for efficient approximate leave-one-out cross-validation
(LOO-CV). See loo_moment_match
for more details.
## S3 method for class 'brmsfit' loo_moment_match( x, loo, k_threshold = 0.7, newdata = NULL, resp = NULL, check = TRUE, ... )
x |
An object of class |
loo |
An object of class |
k_threshold |
The threshold at which Pareto k
estimates are treated as problematic. Defaults to |
newdata |
An optional data.frame for which to evaluate predictions. If
|
resp |
Optional names of response variables. If specified, predictions are performed only for the specified response variables. |
check |
Logical; If |
... |
Further arguments passed to the underlying methods.
Additional arguments initially passed to |
The moment matching algorithm requires samples of all variables
defined in Stan's parameters
block to be saved. Otherwise
loo_moment_match
cannot be computed. Thus, please set
save_pars = save_pars(all = TRUE)
in the call to brm
, if you
are planning to apply loo_moment_match
to your models.
An updated object of class loo
.
Paananen, T., Piironen, J., Buerkner, P.-C., Vehtari, A. (2021). Implicitly Adaptive Importance Sampling. Statistics and Computing.
## Not run: fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient), data = epilepsy, family = poisson(), save_pars = save_pars(all = TRUE)) # throws warning about some pareto k estimates being too high (loo1 <- loo(fit1)) (mmloo1 <- loo_moment_match(fit1, loo = loo1)) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.