2

对于有界度量的先验,我试图在 [-1,1] 之间拉伸 beta 分布,“[a]s 由 Barnard, McCulloch & Meng (2000) 描述”(根据本教程)。

具体来说,我正在尝试实施这个建议:

rho_half_with ~ dbeta(1, 1)
# shifting and streching rho_half_with from [0,1] to [-1,1]
rho ~ 2 * rho_half_with - 1

但是,我总是得到

syntax error on line (...) near "2"

我发现手册中没有关于JAGS或 BUGS 的条目涉及分布操作(作为随机关系分配的来源)。是否确实可以将基本算术运算应用于 BUGS/JAGS 随机关系(遵循~运算符),如果可以,如何?

4

1 回答 1

2

The problem with the code you have posted is that you use a ~ in a non-stochastic relation, where JAGS would want you to use <- instead. The following should work:

rho_half_with ~ dbeta(1, 1)
# shifting and streching rho_half_with from [0,1] to [-1,1]
rho <- 2 * rho_half_with - 1

Regarding the error message you mention in the comments you get that because you try to initiate a variable that is not stochastic (rho). Remove that initialization or switch to initializing rho_half_with to solve that problem.

于 2014-05-27T15:23:04.160 回答