I have a Bayesian Hierarchical model using JAGS. In order to find the best model, I have compared the DIC of two models but It's not reliable. So, I decided to calculate WAIC from JAGS. However I have a big ambiguity and i would appreciate if you help me with this issue.
- Based on theory, DIC is calculated using Deviance, which is equal to -2logliklihood+constant.
Jags give us a deviance, and the dimension of Deviance is equal to (Numofchains*NumberofDraws), and DIC is calculated using deviance.
In theory, deviance= -2logliklihood+constant. So the dimension should be equal to the number of samples(observations), not (Numofchains*NumberofDraws) ??
- In order to calculate WAIC, I need loglikelihood. Jags does not give us Loglikelihood so, via deviance i could not get a right loglikelihood because i don't know what is the constant. So, I calculate Sum(log(normalpdf(posteriors(y,mu,sigma)))),
which returns a vector of likelihoods with the dimension of number of samples.
I am confused. I don't know which one is correct. I would appreciate your help.