waic: Widely applicable information criterion (WAIC)
Description
Widely applicable information criterion (WAIC)
Usage
waic(x, ...)
## S3 method for class 'matrix':
waic(x, ...)
## S3 method for class 'function':
waic(x, ..., args)
Arguments
x
A log-likelihood matrix or function. See the Methods (by
class) section below for a detailed description.
...
Other arguments. Currently ignored.
args
Only required if x is a function. A list containing
the data required to specify the arguments to the function. See the
Methods (by class) section below for how args should be
specified.
matrix: An$S$by$N$matrix, where$S$is the size of the posterior
sample (the number of simulations) and$N$is the number of data points.
Typically (but not restricted to be) the object returned byextract_log_lik.
function: A function$f$that takes argumentsi,data,
anddrawsand returns a vector containing the log-likelihood for
theith observation evaluated at each posterior draw.
Theargsargument must also be specified and should be a named list
with the following components:
draws: An object containing the posterior draws for any
parameters needed to compute the pointwise log-likelihood.
data: An object containing data (e.g. observed outcome and
predictors) needed to compute the pointwise log-likelihood.datashould be in an appropriate form so that$f$(i=i,
data=data[i,,drop=FALSE], draws=draws)returns theS-vector of
log-likelihoods for theith observation.