For developers of modeling packages, loo includes a generic function
kfold so that methods may be defined for K-fold CV without name
conflicts between packages. See, e.g., the kfold.stanreg method in
rstanarm and the kfold.brmsfit method in brms.
kfold(x, ...)is.kfold(x)
A fitted model object.
Arguments to pass to specific methods.
For developers defining a kfold method for a class
"foo", the kfold.foo function should return a list with class
c("kfold", "loo") with at least the elements
"estimates": a 1x2 matrix with column names "Estimate" and "SE"
containing the ELPD estimate and its standard error.
"pointwise": an Nx1 matrix with column name "elpd_kfold" containing
the pointwise contributions for each data point.