if (FALSE) {
# An example generated with the following JAGS model:
#
# model {
# mu[1] <- 0
# mu[2] <- 0
# Sigma[1,1] <- 1
# Sigma[2,2] <- 1
# Sigma[1,2] <- 0.7
# Sigma[2,1] <- 0.7
# x ~ dmnorm(mu, inverse(Sigma))
# }
#
# and the following JAGS script:
#
# model in "mv.7.model"
# compile, nchains(1)
# initialize
# update 1000
# monitor x
# update 10000
# coda *
# Load data written by JAGS
library(coda)
X <- read.coda('CODAchain1.txt', 'CODAindex.txt')
# Dummy distribution object.
N2.dist <- make.dist(2, '2D Normal, cor=0.7', mean=c(0,0))
# Compute simulation result. evals and tuning are hacks; they
# are undefined with Gibbs sampling. JAGS can do its own burn-in,
# so set burn.in to zero.
sim.result <- simulation.result(N2.dist, 'JAGS', X,
evals=nrow(X)*ncol(X), tuning=1,
burn.in=0)
}
Run the code above in your browser using DataLab