This function computes the Deviance Information Criterion (DIC) of a fitmodel from a MCMC sample.

computeDic(trace, fitmodel, initState, data, margLogLike = dTrajObs, ...)

Arguments

trace

either a data.frame or mcmc object. Must contain one column with the posterior logLikelihood.

fitmodel

a fitmodel object

initState

named numeric vector. Initial values of the state variables. Names should match fitmodel$stateNames.

data

data frame. Observation times and observed data. The time column must be named "time" and the observation column must be named "obs".

margLogLike

R-function to compute the marginal log-likelihood of theta.

...

further arguments to be passed to margLogLike

Value

a list of 5 elements:

  • DIC value of the DIC

  • thetaBar mean posterior of theta

  • logLikeThetaBar log-likelihood of thetaBar

  • DThetaBar deviance of thetaBar

  • pD effective number of parameters