dic.samples | R Documentation |

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

model.

```
dic.samples(model, n.iter, thin = 1, type, ...)
```

`model` |
a jags model object |

`n.iter` |
number of iterations to monitor |

`thin` |
thinning interval for monitors |

`type` |
type of penalty to use |

`...` |
optional arguments passed to the update method for jags model objects |

The `dic.samples`

function generates penalized deviance
statistics for use in model comparison. The two alternative 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 at least twice the size of the `pD`

penalty, and
penalizes complex models more severely.

An object of class “dic”. This is a list containing the following elements:

`deviance` |
A numeric vector, with one element for each observed stochastic node, containing the mean deviance for that node |

`penalty` |
A numeric vector, with one element for each observed stochastic node, containing an estimate of the contribution towards the penalty |

`type` |
A string identifying the type of penalty: “pD” or “popt” |

The `popt`

penalty is estimated by importance weighting, and may
be numerically unstable.

Martyn Plummer

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

`diffdic`

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.