View source: R/all_postprodn_fns.R
waic.angmcmc | R Documentation |
Watanabe-Akaike Information Criterion (WAIC) for angmcmc objects
## S3 method for class 'angmcmc' waic(x, ...)
x |
angmcmc object. |
... |
additional model specific arguments to be passed to waic from loo. For example, |
Given a deviance function D(η) = -2 \log(p(y|η)), and an estimate η* = (∑ η_i) / n of the posterior mean E(η|y), where y = (y_1, ..., y_n) denote the data, η is the unknown parameter vector of the model, η_1, ..., η_N are MCMC samples from the posterior distribution of η given y and p(y|η) is the likelihood function, the Watanabe-Akaike Information Criterion (WAIC) is defined as
WAIC = LPPD - p_W
where
LPPD = ∑_{i=1}^n \log (N^{-1} ∑_{s=1}^N p(y_i|η_s) )
and (form 1 of)
p_W = 2 ∑_{i=1}^n [ \log (N^{-1} ∑_{s=1}^N p(y_i|η_s) ) - N^{-1} ∑_{s=1}^N \log \:p(y_i|η_s) ].
An alternative form (form 2) for p_W is given by
p_W = ∑_{i=1}^n \hat{var} \log p(y_i|η)
where for i = 1, ..., n, \hat{var} \log p(y_i|η) denotes the estimated variance of \log p(y_i|η) based on the realizations η_1, ..., η_N.
Note that waic.angmcmc calls waic for computation. If the likelihood contribution of each data
point for each MCMC iteration is available in object
(can be returned by setting return_llik_contri = TRUE
)
during fit_angmix call), waic.array
is used; otherwise waic.function
is
called. Computation is much faster if the likelihood contributions are available - however, they are very
memory intensive, and by default not returned in fit_angmix.
Computes the WAIC for a given angmcmc object.
# illustration only - more iterations needed for convergence fit.vmsin.20 <- fit_vmsinmix(tim8, ncomp = 3, n.iter = 20, n.chains = 1, return_llik_contri = TRUE) library(loo) waic(fit.vmsin.20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.