Learn R Programming

polySegratioMM (version 0.6-2)

calculateDIC: Compute DIC for fitted mixture model

Description

Computes and returns the Deviance Information Critereon (DIC) as suggested by Celeaux et al (2006) as their DIC$_4$ for Bayesian mixture models

Usage

calculateDIC(mcmc.mixture, model, priors, seg.ratios, chain=1, print.DIC=FALSE)

Arguments

mcmc.mixture
Object of type segratioMCMC produced by coda usually by using readJags
model
object of class modelSegratioMM specifying model parameters, ploidy etc
priors
Object of class priorsSegratioMM
seg.ratios
Object of class segRatio contains the segregation ratios for dominant markers and other information such as the number of dominant markers per individual
chain
Which chain to use when compute dosages (Default: 1)
print.DIC
Whether to print DIC

Value

  • A scalar DIC is returned

concept

  • segregation ratio
  • dominant marker
  • autopolyploid

References

  • G Celeaux et. al.
{ (2006) Deviance Information Criteria for Missing Data Models Bayesian Analysis 4 23pp} D Spiegelhalter et. el.{ (2002) Bayesian measures of model complexity and fit JRSS B 64 583--640}

See Also

dosagesMCMC readJags

Examples

Run this code
## simulate small autooctaploid data set
a1 <- sim.autoMarkers(8,c(0.7,0.2,0.1),n.markers=100,n.individuals=50)

## compute segregation ratios
sr <-  segregationRatios(a1$markers)

## set up model, priors, inits etc and write files for JAGS
x <- setModel(3,8)
x2 <- setPriors(x)
dumpData(sr, x)
inits <- setInits(x,x2)
dumpInits(inits)
writeJagsFile(x, x2, stem="test")

## run JAGS
small <- setControl(x, burn.in=200, sample=500)
writeControlFile(small)
rj <- runJags(small)  ## just run it
print(rj)

## read mcmc chains and print DIC
xj <- readJags(rj)
print(calculateDIC(xj, x, x2, sr))

Run the code above in your browser using DataLab