#---------------------------------------------------- # Starting with JAGS: a simple MC # (it is not the principle use of JAGS, but just to check the # installation and get familiar with the sintax) # # GdA 13/2/2015 #---------------------------------------------------- library(rjags) #------------ model ---------------------------- model = "temp_model.bug" write(" model { x ~ dnorm(3, 1/5^2) y <- 2*x+10 z <- x^2 } ", model) jm <- jags.model(model, n.chains = 3) # define the model chain <- coda.samples(jm, c("x","y","z"), n.iter=10000) # sampling print(summary(chain)) plot(chain)