dic.samples {rjags}R Documentation

Generate penalized deviance samples

Description

Function to extract random samples of the penalized deviance from a jags model.

Usage

dic.samples(model, n.iter, thin = 1, type, ...)
## S3 method for class 'dic':
as.mcmc(x)

Arguments

model a jags model object
n.iter number of iterations to monitor
thin thinning interval for monitors
type type of penalty to use
x An object inheriting from class ``dic''
... optional arguments passed to the update method for jags model objects

Details

The dic.samples function generates penalized deviance statistics for use in model comparison. The two penalized deviance statistics generated by dic.samples are the deviance information criterion (DIC) and the penalized expected deviance. These are chosen by giving the values ``pD'' and ``popt'' respectively as the type argument.

DIC (Spiegelhalter et al 2002) is calculated by adding the ``effective number of parameters'' (pD) to the expected deviance. The definition of pD used by dic.samples is the one proposed by Plummer (2002) and requires two or more parallel chains in the model.

DIC is an approximation to the penalized plug-in deviance, which is used when only a point estimate of the parameters is of interest. The DIC approximation only holds asymptotically when the effective number of parameters is much smaller than the sample size, and the model parameters have a normal posterior distribution.

The penalized expected deviance (Plummer 2008) is calculated by adding the optimism (popt) to the expected deviance. The popt penalty is always larger than the pD penalty, and penalizes complex models more severely.

Value

An object of class ``dic''. This is a list containing the following elements:

deviance A list of mcarray objects, one for each observed stochastic node, containing samples of the deviance
penalty A list of mcarray objects, one for each observed stochastic node, containing samples of the penalty function
type A string identifying the type of penalty: ``pD'' or ``popt''


An object of class dic can be coerced to an mcmc object using the as.mcmc generic function. The resulting mcmc object has two variables: the mean deviance over all chains and the penalty.

Note

The popt penalty is estimated by importance weighting, and may be numerically unstable. It is recommended to inspect the dic object after coercing it to a mcmc object using functions from the coda package.

Author(s)

Martyn Plummer

References

Spiegelhalter, D., N. Best, B. Carlin, and A. van der Linde (2002), Bayesian measures of model complexity and fit (with discussion). Journal of the Royal Statistical Society Series B 64, 583-639.

Plummer, M. (2002), Discussion of the paper by Spiegelhalter et al. Journal of the Royal Statistical Society Series B 64, 620.

Plummer, M. (2008) Penalized loss functions for Bayesian model comparison. Biostatistics doi: 10.1093/biostatistics/kxm049

See Also

diffdic


[Package rjags version 1.0.3-8 Index]