# empty plot
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
# add fan
fan(th.mcmc)
##
##Create your own (longer) MCMC sample:
##
library("tsbugs")
library("R2OpenBUGS")
# write model file:
my1.bug <- dget(system.file("model", "my1.txt", package = "fanplot"))
write.model(my1.bug, "my1.txt")
# take a look:
file.show("my1.txt")
# run openbugs
my1.mcmc<-bugs(data=list(n=length(svpdx$pdx),y=svpdx$pdx),
inits=list(list(phistar=0.975,mu=0,itau2=50)),
param=c("mu","phi","tau","theta"),
model="my1.txt",
n.iter=11000, n.burnin=1000, n.chains=1)
th.mcmc <- my1.mcmc$sims.list$theta
Run the code above in your browser using DataLab