JAGS和WinBUGS给出了不同的DIC [英] JAGS and WinBUGS giving differing DIC

查看:321
本文介绍了JAGS和WinBUGS给出了不同的DIC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行网络荟萃分析,其中包括一些临床试验.响应是二项式的.每个试验包含几种治疗方法.

当我做一个随机效果模型时,JAGS和WinBUGS的输出是相似的.当我执行固定效果模型时,尽管我感兴趣的参数的后代相似,但DIC和pD组件却出局了.

我有类似的模型,它们具有高斯响应,而不是二项式,并且JAGS和WinBUGS是一致的.

固定效果模型的BUGS/JAGS代码来自旧帖子描述了一个已知的问题,但这对我来说太老了,以至于我认为这是同样的问题.

JAGS是否存在报告错误DIC和pD的任何已知问题? (搜索"JAGS错误"并没有帮助.)

我将不胜感激任何指针.

解决方案

计算pD的方法有很多,而JAGS使用的方法与WinBUGS使用的方法不同.请参阅以下帮助文件的详细信息"部分:

?rjags::dic

特别是:

DIC(Spiegelhalter等人,2002)是通过将有效参数数量"(pD)与预期偏差相加得出的. dic.samples使用的pD的定义是Plummer(2002)提出的,在模型中需要两个或多个平行链.

有关详细信息,请参见以下论文的(冗长但值得一读):

Spiegelhalter,D.,N.Best,B.Carlin和A. van der Linde(2002),贝叶斯模型复杂度和拟合度的度量(有讨论).皇家统计学会杂志系列B 64,583-639.

通常:所有计算pD的方法(据我所知)都是近似值,如果两种这样的方法不一致,则可能是因为未满足一个(或两个)近似值的假设.

马特

I'm doing a network meta-analysis including several clinical trials. The response is binomial. Each trial contains several treatments.

When I do a random effects model, the output from JAGS and WinBUGS is similar. When I do a fixed effects model, the DIC and pD components are way out, though the posteriors of the parameters I'm interested in are similar.

I've got similar models that have Gaussian response, not binomial, and JAGS and WinBUGS are in agreement.

The BUGS/JAGS code for the fixed effects model is lifted from page 61 of this and appears below. However, the same code runs and produces similar posteriors using WinBUGS and JAGS, it's just DIC and pD that differ markedly. So I don't think this code is the problem.

for(i in 1:ns){  # Loop over studies
  mu[i] ~ dnorm(0, .0001)
    # Vague priors for all trial baselines
  for (k in 1:na[i]) {  # Loop over 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 for linear predictor
    rhat[i, k] <- p[i, k] * n[i, k]
      # expected value of the 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 for this trial
}
totresdev <- sum(resdev[])
  # Total Residual Deviance

d[1] <- 0
  # treatment effect is zero for reference treatment
for (k in 2:nt){
  d[k] ~ dnorm(0, .0001)
}  # vague priors for treatment effects

I found an old post describing a known issue, but that's too old for me to think it's the same problem.

Are there any known issues with JAGS reporting the wrong DIC and pD? (Searching for "JAGS bugs" isn't all that helpful.)

I'd be grateful of any pointers.

解决方案

There are a number of different ways to calculate pD, and the method used by JAGS differs to that used by WinBUGS. See the Details section of the following help file:

?rjags::dic

Specifically:

DIC (Spiegelhalter et al 2002) is calculated by adding the "effective number of parameters" (pD) to the expected deviance. The definition of pD used by dic.samples is the one proposed by Plummer (2002) and requires two or more parallel chains in the model.

The details are in the (lengthy, but well worth reading) discussion of the following paper:

Spiegelhalter, D., N. Best, B. Carlin, and A. van der Linde (2002), Bayesian measures of model complexity and fit (with discussion). Journal of the Royal Statistical Society Series B 64, 583-639.

In general: all methods to calculate pD (of which I am aware) are approximations, and if two such methods disagree then it is probably because the assumptions behind for one (or both) approximation(s) are not being met.

Matt

这篇关于JAGS和WinBUGS给出了不同的DIC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆