是否有与功能类似jags
的R
功能rep
?我想使用类似的代码创建一个数组,如下所示:
n ~ dmulti(pi, N) # pi is a 3 dimensional probability vector, N is fixed
# the dimension of n is hard coded in this line:
a <- c(rep(0, n[1]), rep(1, n[2]), rep(2, n[3]))
我通读了手册,但无法找到实现这一目标的方法。我知道 Stan 可能会允许这样做,但我不能使用 Stan,因为我需要对离散参数进行推断。我真的很感谢你的帮助!
这个问题也发布在JAGS 帮助论坛上。