# NOT RUN {
## Create fake MCMC output
nc <- 10; nr <- 1000
pnames <- c(paste("alpha[", 1:5, "]", sep=""), paste("gamma[", 1:5, "]", sep=""))
means <- rpois(10, 20)
fakemcmc <- coda::as.mcmc.list(
lapply(1:3,
function(i) coda::mcmc(matrix(rnorm(nc*nr, rep(means,each=nr)),
nrow=nr, dimnames=list(NULL,pnames)))))
## Plot traces of the fake MCMC output
traplot(fakemcmc)
traplot(fakemcmc, style="plain")
traplot(fakemcmc, "gamma", greek=TRUE)
## What happens with NULL varnames?
coda::varnames(fakemcmc) <- NULL
traplot(fakemcmc)
# }
# NOT RUN {
## traplot works on bugs objects too
library(R2WinBUGS)
example("openbugs", "R2WinBUGS")
## from the help file for openbugs:
schools.sim <- bugs(data, inits, parameters, model.file,
n.chains = 3, n.iter = 5000,
program = "openbugs", working.directory = NULL)
traplot(schools.sim, "theta")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab