For a prior on a bound measure, I am trying to stretch a beta distribution between [-1,1], "[a]s described by Barnard, McCulloch & Meng (2000)" (according to this tutorial).
Specifically, I am trying to implement this suggestion:
rho_half_with ~ dbeta(1, 1)
# shifting and streching rho_half_with from [0,1] to [-1,1]
rho ~ 2 * rho_half_with - 1
However, I always get
syntax error on line (...) near "2"
No entry in the manual for JAGS or BUGS I found deals with manipulations of distributions (as sources of stochastic relation assignments). Is it indeed possible to apply basic arithmetic operations to BUGS/JAGS stochastic relation (following the ~
operator), and if yes, how?
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.