JAGS and WinBUGS giving differing DIC -
i'm doing network meta-analysis including several clinical trials. response binomial. each trial contains several treatments.
when random effects model, output jags , winbugs similar. when fixed effects model, dic , pd components way out, though posteriors of parameters i'm interested in similar.
i've got similar models have gaussian response, not binomial, , jags , winbugs in agreement.
the bugs/jags code fixed effects model lifted page 61 of this , appears below. however, same code runs , produces similar posteriors using winbugs , jags, it's dic , pd differ markedly. don't think code problem.
for(i in 1:ns){ # loop on studies mu[i] ~ dnorm(0, .0001) # vague priors trial baselines (k in 1:na[i]) { # loop on arms r[i, k] ~ dbin(p[i, k], n[i, k]) # binomial likelihood logit(p[i, k]) <- mu[i] + d[t[i, k]] - d[t[i, 1]] # model linear predictor rhat[i, k] <- p[i, k] * n[i, k] # expected value of numerators dev[i, k] <- 2 * (r[i, k] * (log(r[i, k]) - log(rhat[i, k])) + (n[i, k] - r[i, k]) * (log(n[i, k] - r[i, k]) + - log(n[i, k] - rhat[i, k]) )) # deviance contribution } resdev[i] <- sum(dev[i, 1:na[i]]) # summed residual deviance contribution trial } totresdev <- sum(resdev[]) # total residual deviance d[1] <- 0 # treatment effect 0 reference treatment (k in 2:nt){ d[k] ~ dnorm(0, .0001) } # vague priors treatment effects
i found old post describing known issue, that's old me think it's same problem.
are there known issues jags reporting wrong dic , pd? (searching "jags bugs" isn't helpful.)
i'd grateful of pointers.
there number of different ways calculate pd, , method used jags differs used winbugs. see details section of following file:
?rjags::dic
specifically:
dic (spiegelhalter et al 2002) calculated adding “effective number of parameters” (pd) expected deviance. definition of pd used dic.samples 1 proposed plummer (2002) , requires 2 or more parallel chains in model.
the details in (lengthy, worth reading) discussion of following paper:
spiegelhalter, d., n. best, b. carlin, , a. van der linde (2002), bayesian measures of model complexity , fit (with discussion). journal of royal statistical society series b 64, 583-639.
in general: methods calculate pd (of aware) approximations, , if 2 such methods disagree because assumptions behind 1 (or both) approximation(s) not being met.
matt
Comments
Post a Comment