get.dic: Extract Deviance Information Criterion for a fitted model

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/auxilaryfunctions.R

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("defunct")}

Calculates the Deviance Information Criterion (DIC) for a model fitted using JAGS. WARNING: As of version 1.6, this function is no longer maintained (and probably doesn't work properly, if at all)!

Usage

1
get.dic(jagsfit)

Arguments

jagsfit

The jags.model component of the output, from a model fitted using boral with save.model = TRUE.

Details

Details regarding the Deviance Information Criterion may be found in (Spiegelhalter et al., 2002; Ntzoufras, 2011; Gelman et al., 2013). The DIC here is based on the conditional log-likelihood i.e., the latent variables (and row effects if applicable) are treated as "fixed effects". A DIC based on the marginal likelihood is obtainable from get.more.measures, although this requires a much longer time to compute. For models with overdispered count data, conditional DIC may not perform as well as marginal DIC (Millar, 2009)

Value

DIC value for the jags model.

Note

This function and consequently the DIC value is automatically returned when a model is fitted using boral with calc.ics = TRUE.

Author(s)

Francis K.C. Hui [aut, cre], Wade Blanchard [aut]

Maintainer: Francis K.C. Hui <fhui28@gmail.com>

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
## NOTE: The values below MUST NOT be used in a real application;
## they are only used here to make the examples run quick!!!
example_mcmc_control <- list(n.burnin = 10, n.iteration = 100, 
     n.thin = 1)
     
testpath <- file.path(tempdir(), "jagsboralmodel.txt")


library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
n <- nrow(y)
p <- ncol(y)
    
spiderfit_nb <- boral(y, family = "negative.binomial", lv.control = list(num.lv = 2),
     save.model = TRUE, calc.ics = TRUE, mcmc.control = example_mcmc_control,
     model.name = testpath)

spiderfit_nb$ics ## DIC returned as one of several information criteria.

## End(Not run)

Example output

Loading required package: coda
This is boral version 1.9. If you recently updated boral, please check news(package = "boral") for the updates in the latest version.
module glm loaded
Compiling model graph
   Resolving undeclared variables
   Allocating nodes
Graph information:
   Observed stochastic nodes: 336
   Unobserved stochastic nodes: 439
   Total graph size: 2178

Initializing model

Warning messages:
1: `get.measures()` is deprecated as of boral 1.6.
All functions to calculate information criteria are no longer updated!
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
2: `calc.marglogLik()` is deprecated as of boral 1.9.
We will be phasing out all functions to calculate log-likelihoods of any sort (too hard to maintain)!
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
3: `calc.marglogLik()` is deprecated as of boral 1.6.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
                        Conditional DIC                                    WAIC 
                              1208.5616                               1890.2080 
                                   EAIC                                    EBIC 
                              2007.1986                               2400.3611 
                    AIC at post. median                     BIC at post. median 
                              1894.3986                               2073.8029 
Marginal log-likelihood at post. median 
                              -900.1993 

boral documentation built on March 12, 2021, 5:07 p.m.