Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
非常简单的问题,但我不知何故找不到解决方案。您如何使用 rjags 将现有值(矩阵、向量)传递给 JAGS 模型?
这是一个示例代码:
model{ A = inverse(B) }
而且我想以某种方式传递B = diag(100)到上面的模型中,我该怎么做?
B = diag(100)
您将数据传递给带有dataarg的模型jags.model:
data
jags.model
例如:
library(rjags) M <- 'model { A <- inverse(B) }' j <- jags.model(textConnection(M), data=list(B=diag(10)), n.chains=3) jags.samples(j, 'A', 1000)